meta_types 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +184 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/meta_types/application.js +15 -0
  5. data/app/assets/stylesheets/meta_types/application.css +13 -0
  6. data/app/controllers/meta_types/application_controller.rb +4 -0
  7. data/app/helpers/meta_types/application_helper.rb +4 -0
  8. data/app/models/meta_type.rb +36 -0
  9. data/app/models/meta_type_member.rb +29 -0
  10. data/app/models/meta_type_property.rb +74 -0
  11. data/app/views/layouts/meta_types/application.html.erb +14 -0
  12. data/config/routes.rb +2 -0
  13. data/db/migrate/20120507130230_create_hstore.rb +9 -0
  14. data/db/migrate/20120507130237_meta_type.rb +19 -0
  15. data/db/migrate/20120507130255_meta_type_property.rb +23 -0
  16. data/db/migrate/20120507130303_meta_type_member.rb +18 -0
  17. data/lib/meta_types.rb +9 -0
  18. data/lib/meta_types/active_record.rb +48 -0
  19. data/lib/meta_types/engine.rb +5 -0
  20. data/lib/meta_types/meta_properties.rb +93 -0
  21. data/lib/meta_types/meta_property.rb +27 -0
  22. data/lib/meta_types/meta_property_type.rb +59 -0
  23. data/lib/meta_types/version.rb +3 -0
  24. data/lib/tasks/meta_types_tasks.rake +4 -0
  25. data/test/dummy/README.rdoc +261 -0
  26. data/test/dummy/Rakefile +7 -0
  27. data/test/dummy/app/assets/javascripts/application.js +16 -0
  28. data/test/dummy/app/assets/stylesheets/application.scss +15 -0
  29. data/test/dummy/app/controllers/application_controller.rb +3 -0
  30. data/test/dummy/app/controllers/dashboard_controller.rb +3 -0
  31. data/test/dummy/app/controllers/meta_type_properties_controller.rb +7 -0
  32. data/test/dummy/app/controllers/meta_types_controller.rb +7 -0
  33. data/test/dummy/app/controllers/things_controller.rb +34 -0
  34. data/test/dummy/app/helpers/application_helper.rb +2 -0
  35. data/test/dummy/app/models/thing.rb +6 -0
  36. data/test/dummy/app/views/dashboard/index.html.erb +14 -0
  37. data/test/dummy/app/views/layouts/application.html.erb +58 -0
  38. data/test/dummy/app/views/meta_type_properties/_meta_type_property.html.erb +10 -0
  39. data/test/dummy/app/views/meta_type_properties/edit.html.erb +5 -0
  40. data/test/dummy/app/views/meta_type_properties/index.html.erb +9 -0
  41. data/test/dummy/app/views/meta_type_properties/new.html.erb +5 -0
  42. data/test/dummy/app/views/meta_types/_meta_type.html.erb +6 -0
  43. data/test/dummy/app/views/meta_types/edit.html.erb +5 -0
  44. data/test/dummy/app/views/meta_types/index.html.erb +9 -0
  45. data/test/dummy/app/views/meta_types/new.html.erb +5 -0
  46. data/test/dummy/app/views/things/_thing.html.erb +10 -0
  47. data/test/dummy/app/views/things/edit.html.erb +5 -0
  48. data/test/dummy/app/views/things/index.html.erb +9 -0
  49. data/test/dummy/app/views/things/new.html.erb +12 -0
  50. data/test/dummy/app/views/things/show.html.erb +10 -0
  51. data/test/dummy/config.ru +4 -0
  52. data/test/dummy/config/application.rb +58 -0
  53. data/test/dummy/config/boot.rb +10 -0
  54. data/test/dummy/config/database.yml +25 -0
  55. data/test/dummy/config/environment.rb +5 -0
  56. data/test/dummy/config/environments/development.rb +37 -0
  57. data/test/dummy/config/environments/production.rb +67 -0
  58. data/test/dummy/config/environments/test.rb +37 -0
  59. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/test/dummy/config/initializers/inflections.rb +15 -0
  61. data/test/dummy/config/initializers/mime_types.rb +5 -0
  62. data/test/dummy/config/initializers/secret_token.rb +7 -0
  63. data/test/dummy/config/initializers/session_store.rb +8 -0
  64. data/test/dummy/config/initializers/simple_form.rb +178 -0
  65. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  66. data/test/dummy/config/locales/en.yml +5 -0
  67. data/test/dummy/config/locales/simple_form.en.yml +26 -0
  68. data/test/dummy/config/routes.rb +6 -0
  69. data/test/dummy/db/migrate/20120507130230_create_hstore.rb +9 -0
  70. data/test/dummy/db/migrate/20120507130237_meta_type.rb +19 -0
  71. data/test/dummy/db/migrate/20120507130255_meta_type_property.rb +23 -0
  72. data/test/dummy/db/migrate/20120507130303_meta_type_member.rb +18 -0
  73. data/test/dummy/db/migrate/20120508143058_create_things.rb +14 -0
  74. data/test/dummy/db/seeds.rb +28 -0
  75. data/test/dummy/db/structure.sql +309 -0
  76. data/test/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
  77. data/test/dummy/log/development.log +8958 -0
  78. data/test/dummy/log/test.log +5559 -0
  79. data/test/dummy/public/404.html +26 -0
  80. data/test/dummy/public/422.html +26 -0
  81. data/test/dummy/public/500.html +25 -0
  82. data/test/dummy/public/favicon.ico +0 -0
  83. data/test/dummy/script/rails +6 -0
  84. data/test/dummy/tmp/cache/assets/C7F/AF0/sprockets%2F1f64b7e05e310702c90b98e4816685a2 +0 -0
  85. data/test/dummy/tmp/cache/assets/C94/420/sprockets%2F639d84895339654f12ac2bde8292d447 +0 -0
  86. data/test/dummy/tmp/cache/assets/CB1/FD0/sprockets%2F6e1bd95023705b5529e7ccc754a02867 +0 -0
  87. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  88. data/test/dummy/tmp/cache/assets/CFF/E00/sprockets%2F352bab412d75fa19d0a07504553b59df +0 -0
  89. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  90. data/test/dummy/tmp/cache/assets/D49/8D0/sprockets%2F92613a75279536c4bcf4f3ba6cfde494 +0 -0
  91. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  92. data/test/dummy/tmp/cache/assets/D59/6F0/sprockets%2F7c015202319d3bb46ea41d4ff9b5ac0d +0 -0
  93. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  94. data/test/dummy/tmp/cache/assets/D9F/640/sprockets%2Fbbc63c99f5e0eef2a890442ea3431dd7 +0 -0
  95. data/test/dummy/tmp/cache/assets/DB1/370/sprockets%2F18d79bbfdd80aa3bde79ab687266d992 +0 -0
  96. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  97. data/test/dummy/tmp/cache/assets/E02/0E0/sprockets%2Fa8f15cbf61c3d8edb5a99dbafd690721 +0 -0
  98. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  99. data/test/meta_types_test.rb +7 -0
  100. data/test/test_helper.rb +15 -0
  101. data/test/unit/meta_types/meta_type_test.rb +181 -0
  102. metadata +257 -0
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '09563e896da5c321b48300b10470a821e8e90e2131c929996dd0a342d65c1ffd895b22914d910828b59e2763ae8f2024a1e4d1b2afd500622d61f7f98a5b9911'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,178 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+ config.wrappers :default, :class => :input,
9
+ :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
10
+ ## Extensions enabled by default
11
+ # Any of these extensions can be disabled for a
12
+ # given input by passing: `f.input EXTENSION_NAME => false`.
13
+ # You can make any of these extensions optional by
14
+ # renaming `b.use` to `b.optional`.
15
+
16
+ # Determines whether to use HTML5 (:email, :url, ...)
17
+ # and required attributes
18
+ b.use :html5
19
+
20
+ # Calculates placeholders automatically from I18n
21
+ # You can also pass a string as f.input :placeholder => "Placeholder"
22
+ b.use :placeholder
23
+
24
+ ## Optional extensions
25
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable the lookup for any of those
28
+ # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+ # Calculates maxlength from length validations for string inputs
31
+ b.optional :maxlength
32
+
33
+ # Calculates pattern from format validations for string inputs
34
+ b.optional :pattern
35
+
36
+ # Calculates min and max from length validations for numeric inputs
37
+ b.optional :min_max
38
+
39
+ # Calculates readonly automatically from readonly attributes
40
+ b.optional :readonly
41
+
42
+ ## Inputs
43
+ b.use :label_input
44
+ b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
45
+ b.use :error, :wrap_with => { :tag => :span, :class => :error }
46
+ end
47
+
48
+ config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
49
+ b.use :html5
50
+ b.use :placeholder
51
+ b.use :label
52
+ b.wrapper :tag => 'div', :class => 'controls' do |ba|
53
+ ba.use :input
54
+ ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
55
+ ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
56
+ end
57
+ end
58
+
59
+ config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
60
+ b.use :html5
61
+ b.use :placeholder
62
+ b.use :label
63
+ b.wrapper :tag => 'div', :class => 'controls' do |input|
64
+ input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
65
+ prepend.use :input
66
+ end
67
+ input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
68
+ input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
69
+ end
70
+ end
71
+
72
+ config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
73
+ b.use :html5
74
+ b.use :placeholder
75
+ b.use :label
76
+ b.wrapper :tag => 'div', :class => 'controls' do |input|
77
+ input.wrapper :tag => 'div', :class => 'input-append' do |append|
78
+ append.use :input
79
+ end
80
+ input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
81
+ input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
82
+ end
83
+ end
84
+
85
+ # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
86
+ # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
87
+ # to learn about the different styles for forms and inputs,
88
+ # buttons and other elements.
89
+ config.default_wrapper = :bootstrap
90
+
91
+ # Define the way to render check boxes / radio buttons with labels.
92
+ # Defaults to :nested for bootstrap config.
93
+ # :inline => input + label
94
+ # :nested => label > input
95
+ config.boolean_style = :nested
96
+
97
+ # Default class for buttons
98
+ config.button_class = 'btn'
99
+
100
+ # Method used to tidy up errors. Specify any Rails Array method.
101
+ # :first lists the first message for each field.
102
+ # Use :to_sentence to list all errors for each field.
103
+ # config.error_method = :first
104
+
105
+ # Default tag used for error notification helper.
106
+ config.error_notification_tag = :div
107
+
108
+ # CSS class to add for error notification helper.
109
+ config.error_notification_class = 'alert alert-error'
110
+
111
+ # ID to add for error notification helper.
112
+ # config.error_notification_id = nil
113
+
114
+ # Series of attempts to detect a default label method for collection.
115
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
116
+
117
+ # Series of attempts to detect a default value method for collection.
118
+ # config.collection_value_methods = [ :id, :to_s ]
119
+
120
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
121
+ # config.collection_wrapper_tag = nil
122
+
123
+ # You can define the class to use on all collection wrappers. Defaulting to none.
124
+ # config.collection_wrapper_class = nil
125
+
126
+ # You can wrap each item in a collection of radio/check boxes with a tag,
127
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
128
+ # SimpleForm will force this option to be a label.
129
+ # config.item_wrapper_tag = :span
130
+
131
+ # You can define a class to use in all item wrappers. Defaulting to none.
132
+ # config.item_wrapper_class = nil
133
+
134
+ # How the label text should be generated altogether with the required text.
135
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
136
+
137
+ # You can define the class to use on all labels. Default is nil.
138
+ config.label_class = 'control-label'
139
+
140
+ # You can define the class to use on all forms. Default is simple_form.
141
+ # config.form_class = :simple_form
142
+
143
+ # You can define which elements should obtain additional classes
144
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
145
+
146
+ # Whether attributes are required by default (or not). Default is true.
147
+ # config.required_by_default = true
148
+
149
+ # Tell browsers whether to use default HTML5 validations (novalidate option).
150
+ # Default is enabled.
151
+ config.browser_validations = false
152
+
153
+ # Collection of methods to detect if a file type was given.
154
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
155
+
156
+ # Custom mappings for input types. This should be a hash containing a regexp
157
+ # to match as key, and the input type that will be used when the field name
158
+ # matches the regexp as value.
159
+ # config.input_mappings = { /count/ => :integer }
160
+
161
+ # Default priority for time_zone inputs.
162
+ # config.time_zone_priority = nil
163
+
164
+ # Default priority for country inputs.
165
+ # config.country_priority = nil
166
+
167
+ # Default size for text inputs.
168
+ # config.default_input_size = 50
169
+
170
+ # When false, do not use translations for labels.
171
+ # config.translate_labels = true
172
+
173
+ # Automatically discover new inputs in Rails' autoload path.
174
+ # config.inputs_discovery = true
175
+
176
+ # Cache SimpleForm inputs discovery
177
+ # config.cache_discovery = !Rails.env.development?
178
+ end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,26 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Labels and hints examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ resources :meta_types
3
+ resources :meta_type_properties
4
+ resources :things
5
+ root to: 'dashboard#index'
6
+ end
@@ -0,0 +1,9 @@
1
+ class CreateHstore < ActiveRecord::Migration
2
+ def self.up
3
+ execute "CREATE EXTENSION hstore"
4
+ end
5
+
6
+ def self.down
7
+ execute "DROP EXTENSION hstore"
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ class MetaType < ActiveRecord::Migration
2
+ def up
3
+ # we have a type column to allow STI to have a ProductType, a CustomerType and the like
4
+ execute <<-CREATE_SQL
5
+ create table meta_types (
6
+ id serial PRIMARY KEY,
7
+ sid character varying not null UNIQUE,
8
+ type character varying,
9
+ title character varying not null UNIQUE,
10
+ created_at timestamp without time zone,
11
+ updated_at timestamp without time zone
12
+ );
13
+ CREATE_SQL
14
+ end
15
+
16
+ def down
17
+ execute "DROP TABLE meta_types"
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ class MetaTypeProperty < ActiveRecord::Migration
2
+ def up
3
+ execute <<-CREATE_SQL
4
+ create table meta_type_properties (
5
+ id serial NOT NULL PRIMARY KEY,
6
+ sid character varying,
7
+ label character varying not null,
8
+ property_type_sid character varying not null,
9
+ required boolean not null default false,
10
+ system boolean not null default false,
11
+ dimension character varying null default null,
12
+ default_value character varying null default null,
13
+ choices character varying,
14
+ created_at timestamp without time zone,
15
+ updated_at timestamp without time zone
16
+ );
17
+ CREATE_SQL
18
+ end
19
+
20
+ def down
21
+ execute "drop table meta_type_properties"
22
+ end
23
+ end