tripper 0.0.3d
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/TODO +26 -0
- data/lib/generators/USAGE +8 -0
- data/lib/generators/tripper.rb +51 -0
- data/lib/generators/tripper/commonalities/commonalities.rb +226 -0
- data/lib/generators/tripper/detect_changes/detect_changes_generator.rb +173 -0
- data/lib/generators/tripper/detect_changes/model.rb +226 -0
- data/lib/generators/tripper/detect_changes/templates/migration.rb +7 -0
- data/lib/generators/tripper/detect_changes/templates/model/belongs_to.rb +1 -0
- data/lib/generators/tripper/detect_changes/templates/model/has_one.rb +1 -0
- data/lib/generators/tripper/detect_changes/templates/model/validates.rb +2 -0
- data/lib/generators/tripper/from_community/from_community_generator.rb +95 -0
- data/lib/generators/tripper/from_community/templates/actions/create.rb +8 -0
- data/lib/generators/tripper/from_community/templates/actions/destroy.rb +5 -0
- data/lib/generators/tripper/from_community/templates/actions/edit.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/index.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/new.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/show.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/update.rb +8 -0
- data/lib/generators/tripper/from_community/templates/controller.rb +3 -0
- data/lib/generators/tripper/from_community/templates/fixtures.yml +9 -0
- data/lib/generators/tripper/from_community/templates/helper.rb +2 -0
- data/lib/generators/tripper/from_community/templates/migration.rb +30 -0
- data/lib/generators/tripper/from_community/templates/model.rb +54 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/tripper/from_community/templates/views/erb/_form.html.erb +16 -0
- data/lib/generators/tripper/from_community/templates/views/erb/edit.html.erb +14 -0
- data/lib/generators/tripper/from_community/templates/views/erb/index.html.erb +29 -0
- data/lib/generators/tripper/from_community/templates/views/erb/new.html.erb +7 -0
- data/lib/generators/tripper/from_community/templates/views/erb/show.html.erb +25 -0
- data/lib/generators/tripper/from_community/templates/views/haml/_form.html.haml +9 -0
- data/lib/generators/tripper/from_community/templates/views/haml/edit.html.haml +14 -0
- data/lib/generators/tripper/from_community/templates/views/haml/index.html.haml +25 -0
- data/lib/generators/tripper/from_community/templates/views/haml/new.html.haml +7 -0
- data/lib/generators/tripper/from_community/templates/views/haml/show.html.haml +20 -0
- data/lib/generators/tripper/layout/USAGE +18 -0
- data/lib/generators/tripper/layout/layout_generator.rb +29 -0
- data/lib/generators/tripper/layout/templates/error_messages_helper.rb +23 -0
- data/lib/generators/tripper/layout/templates/layout.html.erb +19 -0
- data/lib/generators/tripper/layout/templates/layout.html.haml +21 -0
- data/lib/generators/tripper/layout/templates/layout_helper.rb +22 -0
- data/lib/generators/tripper/layout/templates/stylesheet.css +83 -0
- data/lib/generators/tripper/layout/templates/stylesheet.sass +73 -0
- data/lib/generators/tripper/obj_constraint.rb +23 -0
- data/lib/generators/tripper/predicate.rb +12 -0
- data/lib/generators/tripper/sync_with_community/model.rb +260 -0
- data/lib/generators/tripper/sync_with_community/sync_with_community_generator.rb +310 -0
- data/lib/generators/tripper/sync_with_community/templates/migration.rb +7 -0
- data/lib/generators/tripper/sync_with_community/templates/model/belongs_to.rb +1 -0
- data/lib/generators/tripper/sync_with_community/templates/model/has_one.rb +1 -0
- data/lib/generators/tripper/sync_with_community/templates/model/validates.rb +2 -0
- data/lib/generators/tripper/templates/actions/create.rb +8 -0
- data/lib/generators/tripper/templates/actions/destroy.rb +5 -0
- data/lib/generators/tripper/templates/actions/edit.rb +3 -0
- data/lib/generators/tripper/templates/actions/index.rb +3 -0
- data/lib/generators/tripper/templates/actions/new.rb +3 -0
- data/lib/generators/tripper/templates/actions/show.rb +3 -0
- data/lib/generators/tripper/templates/actions/update.rb +8 -0
- data/lib/generators/tripper/templates/controller.rb +3 -0
- data/lib/generators/tripper/templates/fixtures.yml +9 -0
- data/lib/generators/tripper/templates/helper.rb +2 -0
- data/lib/generators/tripper/templates/migration.rb +30 -0
- data/lib/generators/tripper/templates/model.rb +54 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/tripper/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/tripper/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/tripper/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/tripper/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/tripper/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/tripper/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/tripper/templates/views/erb/_form.html.erb +16 -0
- data/lib/generators/tripper/templates/views/erb/edit.html.erb +14 -0
- data/lib/generators/tripper/templates/views/erb/index.html.erb +29 -0
- data/lib/generators/tripper/templates/views/erb/new.html.erb +7 -0
- data/lib/generators/tripper/templates/views/erb/show.html.erb +25 -0
- data/lib/generators/tripper/templates/views/haml/_form.html.haml +9 -0
- data/lib/generators/tripper/templates/views/haml/edit.html.haml +14 -0
- data/lib/generators/tripper/templates/views/haml/index.html.haml +25 -0
- data/lib/generators/tripper/templates/views/haml/new.html.haml +7 -0
- data/lib/generators/tripper/templates/views/haml/show.html.haml +20 -0
- data/lib/tripper.rb +1 -0
- data/lib/tripper/GOSPLDB/config/database.yml +6 -0
- data/lib/tripper/GOSPLDB/config_db.rb +9 -0
- data/lib/tripper/GOSPLDB/console +2 -0
- data/lib/tripper/GOSPLDB/gospl_db_classes.rb +343 -0
- data/lib/tripper/GOSPLDB/play_around.rb +4 -0
- data/lib/tripper/GOSPLDB/rakefile.rb +88 -0
- data/lib/tripper/GOSPLDBToORMDB/gospl_db_to_orm_db.rb +88 -0
- data/lib/tripper/ORMDB/config/database.yml +6 -0
- data/lib/tripper/ORMDB/config_db.rb +9 -0
- data/lib/tripper/ORMDB/console +2 -0
- data/lib/tripper/ORMDB/db/migrations/0_create_orm_object_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/10_create_no_lot_constraint_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/11_create_value_constraint_table.rb +14 -0
- data/lib/tripper/ORMDB/db/migrations/12_create_value_constraint_value_table.rb +16 -0
- data/lib/tripper/ORMDB/db/migrations/13_create_value_range_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/14_create_frequency_constraint_table.rb +16 -0
- data/lib/tripper/ORMDB/db/migrations/15_create_value_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/16_create_ring_constraint_table.rb +14 -0
- data/lib/tripper/ORMDB/db/migrations/17_create_orm_schema_table.rb +21 -0
- data/lib/tripper/ORMDB/db/migrations/18_create_uniqueness_constraint_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/1_create_no_lot_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/2_create_lot_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/3_create_object_role_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/4_create_reference_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/5_create_predicate_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/6_create_object_role_constraint_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/7_create_subtype_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/8_create_mandatory_constraint_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/9_create_constraint_table.rb +15 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3 +0 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3.backup +0 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3.juli28-2013 +0 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3.old +0 -0
- data/lib/tripper/ORMDB/db/schema.rb +58 -0
- data/lib/tripper/ORMDB/erd.pdf +0 -0
- data/lib/tripper/ORMDB/migrate_db.rb +21 -0
- data/lib/tripper/ORMDB/orm_db_classes.rb +423 -0
- data/lib/tripper/ORMDB/populate.rb +4 -0
- data/lib/tripper/ORMDB/rakefile.rb +88 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParser.g +50 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParser.tokens +13 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParserLexer.rb +538 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParserParser.rb +412 -0
- data/lib/tripper/model_parsers/attribute_parser/playing_around.rb +14 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParser.g +63 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParser.tokens +21 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParserLexer.rb +667 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParserParser.rb +552 -0
- data/lib/tripper/model_parsers/belongs_to/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParser.g +47 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParser.tokens +14 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParserLexer.rb +513 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParserParser.rb +279 -0
- data/lib/tripper/model_parsers/database_fields_parser/playing_around.rb +14 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParser.g +92 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParser.tokens +25 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParserLexer.rb +787 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParserParser.rb +1024 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/has_many/HasManyParser.g +77 -0
- data/lib/tripper/model_parsers/has_many/HasManyParser.tokens +23 -0
- data/lib/tripper/model_parsers/has_many/HasManyParserLexer.rb +710 -0
- data/lib/tripper/model_parsers/has_many/HasManyParserParser.rb +788 -0
- data/lib/tripper/model_parsers/has_many/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/has_one/HasOneParser.g +63 -0
- data/lib/tripper/model_parsers/has_one/HasOneParser.tokens +21 -0
- data/lib/tripper/model_parsers/has_one/HasOneParserLexer.rb +664 -0
- data/lib/tripper/model_parsers/has_one/HasOneParserParser.rb +552 -0
- data/lib/tripper/model_parsers/has_one/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/validates/ValidatesParser.g +68 -0
- data/lib/tripper/model_parsers/validates/ValidatesParser.tokens +35 -0
- data/lib/tripper/model_parsers/validates/ValidatesParserLexer.rb +899 -0
- data/lib/tripper/model_parsers/validates/ValidatesParserParser.rb +869 -0
- data/lib/tripper/model_parsers/validates/playing_around.rb +9 -0
- data/lib/tripper/rails.rb +8 -0
- data/lib/tripper/version.rb +3 -0
- data/tripper.gemspec +33 -0
- metadata +408 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateOrmObjectTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :orm_objects do |t|
|
6
|
+
t.string :name
|
7
|
+
t.boolean :independent
|
8
|
+
t.boolean :numeric
|
9
|
+
t.integer :orm_schema_id
|
10
|
+
t.string :type
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
drop_table :orm_objects
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateNoLotConstraintTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :no_lot_constraints do |t|
|
6
|
+
t.integer :no_lot_id
|
7
|
+
t.integer :constraint_id
|
8
|
+
t.string :constraint_type
|
9
|
+
t.string :role
|
10
|
+
t.integer :orm_schema_id
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
drop_table :no_lot_constraints
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateValueConstraintTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :value_constraints do |t|
|
6
|
+
t.integer :lot_id
|
7
|
+
t.integer :orm_schema_id
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
drop_table :Value_constraints
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateValueConstraintValueTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :value_constraint_values do |t|
|
6
|
+
t.integer :valueish_id
|
7
|
+
t.string :valueish_type
|
8
|
+
t.integer :value_constraint_id
|
9
|
+
t.integer :orm_schema_id
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :value_constraint_values
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateValueRangeTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :value_ranges do |t|
|
6
|
+
t.integer :start_value_id
|
7
|
+
t.integer :end_value_id
|
8
|
+
t.integer :orm_schema_id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
drop_table :value_ranges
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateFrequencyConstraintTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :frequency_constraints do |t|
|
6
|
+
t.integer :minimum
|
7
|
+
t.integer :maximum
|
8
|
+
t.integer :object_role_id
|
9
|
+
t.integer :orm_schema_id
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :frequency_constraints
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateOrmSchemaTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :orm_schemas do |t|
|
6
|
+
t.string :title
|
7
|
+
t.string :creator
|
8
|
+
t.string :version
|
9
|
+
t.text :description
|
10
|
+
t.datetime :last_import
|
11
|
+
t.datetime :last_export
|
12
|
+
t.text :origin
|
13
|
+
t.integer :orm_schema_id
|
14
|
+
end
|
15
|
+
add_index :orm_schemas, :title
|
16
|
+
end
|
17
|
+
|
18
|
+
def down
|
19
|
+
drop_table :orm_schemas
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateUniquenessConstraintTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :uniqueness_constraints do |t|
|
6
|
+
t.string :type
|
7
|
+
t.integer :orm_schema_id
|
8
|
+
t.string :identifier
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
drop_table :uniqueness_constraints
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateNoLotTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :no_lots do |t|
|
6
|
+
t.string :name
|
7
|
+
t.string :application_name
|
8
|
+
t.boolean :independent
|
9
|
+
t.integer :orm_schema_id
|
10
|
+
end
|
11
|
+
add_index :no_lots, :application_name
|
12
|
+
add_index :no_lots, :name
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
drop_table :no_lots
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateLotTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :lots do |t|
|
6
|
+
t.string :name
|
7
|
+
t.string :application_name
|
8
|
+
t.boolean :numeric
|
9
|
+
t.integer :orm_schema_id
|
10
|
+
end
|
11
|
+
add_index :lots, :application_name
|
12
|
+
add_index :lots, :name
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
drop_table :lots
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateObjectRoleTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :object_roles do |t|
|
6
|
+
t.string :role
|
7
|
+
t.string :identifier
|
8
|
+
t.integer :predicate_id
|
9
|
+
t.integer :orm_object_id
|
10
|
+
t.string :orm_object_type
|
11
|
+
t.integer :orm_schema_id
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
drop_table :object_roles
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateReferenceTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :references do |t|
|
6
|
+
t.string :name
|
7
|
+
t.boolean :numeric
|
8
|
+
t.integer :orm_object_id
|
9
|
+
t.string :orm_object_type
|
10
|
+
t.integer :orm_schema_id
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
drop_table :references
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreatePredicateTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :predicates do |t|
|
6
|
+
t.boolean :derived
|
7
|
+
t.boolean :derived_stored
|
8
|
+
t.boolean :predicate_object
|
9
|
+
t.string :predicate_name
|
10
|
+
t.integer :orm_schema_id
|
11
|
+
t.string :identifier
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
drop_table :predicates
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class CreateObjectRoleConstraintTable < ActiveRecord::Migration
|
5
|
+
def up
|
6
|
+
create_table :object_role_constraints do |t|
|
7
|
+
t.integer :object_role_id
|
8
|
+
t.integer :constraint_id
|
9
|
+
t.string :constraint_type
|
10
|
+
t.string :role
|
11
|
+
t.integer :orm_schema_id
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
drop_table :object_role_constraints
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateSubtypeTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :subtypes do |t|
|
6
|
+
t.integer :parent_id
|
7
|
+
t.string :parent_role
|
8
|
+
t.integer :child_id
|
9
|
+
t.string :child_role
|
10
|
+
t.integer :orm_schema_id
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
drop_table :subtypes
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateMandatoryConstraintTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :mandatory_constraints do |t|
|
6
|
+
t.string :type
|
7
|
+
t.integer :orm_schema_id
|
8
|
+
t.string :identifier
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
drop_table :mandatory_constraints
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
class CreateConstraintTable < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
create_table :constraints do |t|
|
6
|
+
t.string :type
|
7
|
+
t.integer :orm_schema_id
|
8
|
+
t.string :identifier
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
drop_table :constraints
|
14
|
+
end
|
15
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 8) do
|
14
|
+
|
15
|
+
create_table "mandatory_constraints", :force => true do |t|
|
16
|
+
end
|
17
|
+
|
18
|
+
create_table "object_role_constraints", :force => true do |t|
|
19
|
+
t.integer "object_role_id"
|
20
|
+
t.integer "constraint_id"
|
21
|
+
t.string "constraint_type"
|
22
|
+
t.string "type"
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "object_roles", :force => true do |t|
|
26
|
+
t.string "role"
|
27
|
+
t.integer "predicate_id"
|
28
|
+
t.integer "orm_object_id"
|
29
|
+
end
|
30
|
+
|
31
|
+
create_table "orm_objects", :force => true do |t|
|
32
|
+
t.string "name"
|
33
|
+
t.boolean "independent"
|
34
|
+
t.boolean "numeric"
|
35
|
+
t.integer "orm_schema_id"
|
36
|
+
t.string "type"
|
37
|
+
end
|
38
|
+
|
39
|
+
create_table "predicates", :force => true do |t|
|
40
|
+
t.boolean "derived"
|
41
|
+
t.boolean "derived_stored"
|
42
|
+
t.boolean "predicate_object"
|
43
|
+
t.string "predicate_name"
|
44
|
+
end
|
45
|
+
|
46
|
+
create_table "references", :force => true do |t|
|
47
|
+
t.string "name"
|
48
|
+
t.boolean "numeric"
|
49
|
+
t.integer "orm_object_id"
|
50
|
+
end
|
51
|
+
|
52
|
+
create_table "subset_constraints", :force => true do |t|
|
53
|
+
end
|
54
|
+
|
55
|
+
create_table "uniqueness_constraints", :force => true do |t|
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# original source of this file:
|
2
|
+
# https://github.com/vitezg/simple-migrations-without-rails/blob/master/src/migratedb.rb
|
3
|
+
|
4
|
+
puts File.dirname(__FILE__) + '/config_db'
|
5
|
+
require File.dirname(__FILE__) + '/config_db'
|
6
|
+
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
puts "hello world"
|
10
|
+
|
11
|
+
puts ActiveRecord::Base.connection_config
|
12
|
+
|
13
|
+
puts "Current version:", ActiveRecord::Migrator.current_version
|
14
|
+
|
15
|
+
#turn on extra information
|
16
|
+
ActiveRecord::Migration.verbose = true
|
17
|
+
|
18
|
+
#migrations should be placed in the "migrations" subdirectory
|
19
|
+
#the script's argv[0] should be the desired version to migrate to
|
20
|
+
#if there is no argument, this will migrate to the highest version
|
21
|
+
ActiveRecord::Migrator.migrate File.dirname(__FILE__) +"migrations/", ARGV[0] ? ARGV[0].to_i : nil
|