activerecord 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- data/CHANGELOG +4928 -3
 - data/README +45 -46
 - data/RUNNING_UNIT_TESTS +8 -11
 - data/Rakefile +247 -0
 - data/install.rb +8 -38
 - data/lib/active_record/aggregations.rb +64 -49
 - data/lib/active_record/associations/association_collection.rb +217 -47
 - data/lib/active_record/associations/association_proxy.rb +159 -0
 - data/lib/active_record/associations/belongs_to_association.rb +56 -0
 - data/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
 - data/lib/active_record/associations/has_and_belongs_to_many_association.rb +155 -37
 - data/lib/active_record/associations/has_many_association.rb +145 -75
 - data/lib/active_record/associations/has_many_through_association.rb +283 -0
 - data/lib/active_record/associations/has_one_association.rb +96 -0
 - data/lib/active_record/associations.rb +1537 -304
 - data/lib/active_record/attribute_methods.rb +328 -0
 - data/lib/active_record/base.rb +2001 -588
 - data/lib/active_record/calculations.rb +269 -0
 - data/lib/active_record/callbacks.rb +169 -165
 - data/lib/active_record/connection_adapters/abstract/connection_specification.rb +308 -0
 - data/lib/active_record/connection_adapters/abstract/database_statements.rb +171 -0
 - data/lib/active_record/connection_adapters/abstract/query_cache.rb +87 -0
 - data/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
 - data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +472 -0
 - data/lib/active_record/connection_adapters/abstract/schema_statements.rb +306 -0
 - data/lib/active_record/connection_adapters/abstract_adapter.rb +125 -279
 - data/lib/active_record/connection_adapters/mysql_adapter.rb +442 -77
 - data/lib/active_record/connection_adapters/postgresql_adapter.rb +805 -135
 - data/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
 - data/lib/active_record/connection_adapters/sqlite_adapter.rb +353 -69
 - data/lib/active_record/fixtures.rb +946 -100
 - data/lib/active_record/locking/optimistic.rb +144 -0
 - data/lib/active_record/locking/pessimistic.rb +77 -0
 - data/lib/active_record/migration.rb +417 -0
 - data/lib/active_record/observer.rb +142 -32
 - data/lib/active_record/query_cache.rb +23 -0
 - data/lib/active_record/reflection.rb +163 -70
 - data/lib/active_record/schema.rb +58 -0
 - data/lib/active_record/schema_dumper.rb +171 -0
 - data/lib/active_record/serialization.rb +98 -0
 - data/lib/active_record/serializers/json_serializer.rb +71 -0
 - data/lib/active_record/serializers/xml_serializer.rb +315 -0
 - data/lib/active_record/timestamp.rb +41 -0
 - data/lib/active_record/transactions.rb +87 -57
 - data/lib/active_record/validations.rb +909 -122
 - data/lib/active_record/vendor/db2.rb +362 -0
 - data/lib/active_record/vendor/mysql.rb +126 -29
 - data/lib/active_record/version.rb +9 -0
 - data/lib/active_record.rb +35 -7
 - data/lib/activerecord.rb +1 -0
 - data/test/aaa_create_tables_test.rb +72 -0
 - data/test/abstract_unit.rb +73 -5
 - data/test/active_schema_test_mysql.rb +43 -0
 - data/test/adapter_test.rb +105 -0
 - data/test/adapter_test_sqlserver.rb +95 -0
 - data/test/aggregations_test.rb +110 -16
 - data/test/all.sh +2 -2
 - data/test/ar_schema_test.rb +33 -0
 - data/test/association_inheritance_reload.rb +14 -0
 - data/test/associations/ar_joins_test.rb +0 -0
 - data/test/associations/callbacks_test.rb +147 -0
 - data/test/associations/cascaded_eager_loading_test.rb +110 -0
 - data/test/associations/eager_singularization_test.rb +145 -0
 - data/test/associations/eager_test.rb +442 -0
 - data/test/associations/extension_test.rb +47 -0
 - data/test/associations/inner_join_association_test.rb +88 -0
 - data/test/associations/join_model_test.rb +553 -0
 - data/test/associations_test.rb +1930 -267
 - data/test/attribute_methods_test.rb +146 -0
 - data/test/base_test.rb +1316 -84
 - data/test/binary_test.rb +32 -0
 - data/test/calculations_test.rb +251 -0
 - data/test/callbacks_test.rb +400 -0
 - data/test/class_inheritable_attributes_test.rb +3 -4
 - data/test/column_alias_test.rb +17 -0
 - data/test/connection_test_firebird.rb +8 -0
 - data/test/connection_test_mysql.rb +30 -0
 - data/test/connections/native_db2/connection.rb +25 -0
 - data/test/connections/native_firebird/connection.rb +26 -0
 - data/test/connections/native_frontbase/connection.rb +27 -0
 - data/test/connections/native_mysql/connection.rb +21 -18
 - data/test/connections/native_openbase/connection.rb +21 -0
 - data/test/connections/native_oracle/connection.rb +27 -0
 - data/test/connections/native_postgresql/connection.rb +17 -18
 - data/test/connections/native_sqlite/connection.rb +17 -16
 - data/test/connections/native_sqlite3/connection.rb +25 -0
 - data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
 - data/test/connections/native_sybase/connection.rb +23 -0
 - data/test/copy_table_test_sqlite.rb +69 -0
 - data/test/datatype_test_postgresql.rb +203 -0
 - data/test/date_time_test.rb +37 -0
 - data/test/default_test_firebird.rb +16 -0
 - data/test/defaults_test.rb +67 -0
 - data/test/deprecated_finder_test.rb +30 -0
 - data/test/finder_test.rb +607 -32
 - data/test/fixtures/accounts.yml +28 -0
 - data/test/fixtures/all/developers.yml +0 -0
 - data/test/fixtures/all/people.csv +0 -0
 - data/test/fixtures/all/tasks.yml +0 -0
 - data/test/fixtures/author.rb +107 -0
 - data/test/fixtures/author_favorites.yml +4 -0
 - data/test/fixtures/authors.yml +7 -0
 - data/test/fixtures/bad_fixtures/attr_with_numeric_first_char +1 -0
 - data/test/fixtures/bad_fixtures/attr_with_spaces +1 -0
 - data/test/fixtures/bad_fixtures/blank_line +3 -0
 - data/test/fixtures/bad_fixtures/duplicate_attributes +3 -0
 - data/test/fixtures/bad_fixtures/missing_value +1 -0
 - data/test/fixtures/binaries.yml +132 -0
 - data/test/fixtures/binary.rb +2 -0
 - data/test/fixtures/book.rb +4 -0
 - data/test/fixtures/books.yml +7 -0
 - data/test/fixtures/categories/special_categories.yml +9 -0
 - data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
 - data/test/fixtures/categories.yml +14 -0
 - data/test/fixtures/categories_ordered.yml +7 -0
 - data/test/fixtures/categories_posts.yml +23 -0
 - data/test/fixtures/categorization.rb +5 -0
 - data/test/fixtures/categorizations.yml +17 -0
 - data/test/fixtures/category.rb +26 -0
 - data/test/fixtures/citation.rb +6 -0
 - data/test/fixtures/comment.rb +23 -0
 - data/test/fixtures/comments.yml +59 -0
 - data/test/fixtures/companies.yml +55 -0
 - data/test/fixtures/company.rb +81 -4
 - data/test/fixtures/company_in_module.rb +32 -6
 - data/test/fixtures/computer.rb +4 -0
 - data/test/fixtures/computers.yml +4 -0
 - data/test/fixtures/contact.rb +16 -0
 - data/test/fixtures/courses.yml +7 -0
 - data/test/fixtures/customer.rb +28 -3
 - data/test/fixtures/customers.yml +17 -0
 - data/test/fixtures/db_definitions/db2.drop.sql +33 -0
 - data/test/fixtures/db_definitions/db2.sql +235 -0
 - data/test/fixtures/db_definitions/db22.drop.sql +2 -0
 - data/test/fixtures/db_definitions/db22.sql +5 -0
 - data/test/fixtures/db_definitions/firebird.drop.sql +65 -0
 - data/test/fixtures/db_definitions/firebird.sql +310 -0
 - data/test/fixtures/db_definitions/firebird2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/firebird2.sql +6 -0
 - data/test/fixtures/db_definitions/frontbase.drop.sql +33 -0
 - data/test/fixtures/db_definitions/frontbase.sql +273 -0
 - data/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
 - data/test/fixtures/db_definitions/frontbase2.sql +4 -0
 - data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
 - data/test/fixtures/db_definitions/openbase.sql +318 -0
 - data/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/openbase2.sql +7 -0
 - data/test/fixtures/db_definitions/oracle.drop.sql +67 -0
 - data/test/fixtures/db_definitions/oracle.sql +330 -0
 - data/test/fixtures/db_definitions/oracle2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/oracle2.sql +6 -0
 - data/test/fixtures/db_definitions/postgresql.drop.sql +44 -0
 - data/test/fixtures/db_definitions/postgresql.sql +217 -38
 - data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/postgresql2.sql +2 -2
 - data/test/fixtures/db_definitions/schema.rb +354 -0
 - data/test/fixtures/db_definitions/schema2.rb +11 -0
 - data/test/fixtures/db_definitions/sqlite.drop.sql +33 -0
 - data/test/fixtures/db_definitions/sqlite.sql +139 -5
 - data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/sqlite2.sql +1 -0
 - data/test/fixtures/db_definitions/sybase.drop.sql +35 -0
 - data/test/fixtures/db_definitions/sybase.sql +222 -0
 - data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
 - data/test/fixtures/db_definitions/sybase2.sql +5 -0
 - data/test/fixtures/developer.rb +70 -6
 - data/test/fixtures/developers.yml +21 -0
 - data/test/fixtures/developers_projects/david_action_controller +2 -1
 - data/test/fixtures/developers_projects/david_active_record +2 -1
 - data/test/fixtures/developers_projects.yml +17 -0
 - data/test/fixtures/edge.rb +5 -0
 - data/test/fixtures/edges.yml +6 -0
 - data/test/fixtures/entrants.yml +14 -0
 - data/test/fixtures/example.log +1 -0
 - data/test/fixtures/fk_test_has_fk.yml +3 -0
 - data/test/fixtures/fk_test_has_pk.yml +2 -0
 - data/test/fixtures/flowers.jpg +0 -0
 - data/test/fixtures/funny_jokes.yml +10 -0
 - data/test/fixtures/item.rb +7 -0
 - data/test/fixtures/items.yml +4 -0
 - data/test/fixtures/joke.rb +3 -0
 - data/test/fixtures/keyboard.rb +3 -0
 - data/test/fixtures/legacy_thing.rb +3 -0
 - data/test/fixtures/legacy_things.yml +3 -0
 - data/test/fixtures/matey.rb +4 -0
 - data/test/fixtures/mateys.yml +4 -0
 - data/test/fixtures/migrations/1_people_have_last_names.rb +9 -0
 - data/test/fixtures/migrations/2_we_need_reminders.rb +12 -0
 - data/test/fixtures/migrations/3_innocent_jointable.rb +12 -0
 - data/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
 - data/test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb +9 -0
 - data/test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb +12 -0
 - data/test/fixtures/migrations_with_duplicate/3_foo.rb +7 -0
 - data/test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb +12 -0
 - data/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
 - data/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
 - data/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
 - data/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
 - data/test/fixtures/minimalistic.rb +2 -0
 - data/test/fixtures/minimalistics.yml +2 -0
 - data/test/fixtures/mixed_case_monkey.rb +3 -0
 - data/test/fixtures/mixed_case_monkeys.yml +6 -0
 - data/test/fixtures/mixins.yml +29 -0
 - data/test/fixtures/movies.yml +7 -0
 - data/test/fixtures/naked/csv/accounts.csv +1 -0
 - data/test/fixtures/naked/yml/accounts.yml +1 -0
 - data/test/fixtures/naked/yml/companies.yml +1 -0
 - data/test/fixtures/naked/yml/courses.yml +1 -0
 - data/test/fixtures/order.rb +4 -0
 - data/test/fixtures/parrot.rb +13 -0
 - data/test/fixtures/parrots.yml +27 -0
 - data/test/fixtures/parrots_pirates.yml +7 -0
 - data/test/fixtures/people.yml +3 -0
 - data/test/fixtures/person.rb +4 -0
 - data/test/fixtures/pirate.rb +5 -0
 - data/test/fixtures/pirates.yml +9 -0
 - data/test/fixtures/post.rb +59 -0
 - data/test/fixtures/posts.yml +48 -0
 - data/test/fixtures/project.rb +27 -2
 - data/test/fixtures/projects.yml +7 -0
 - data/test/fixtures/reader.rb +4 -0
 - data/test/fixtures/readers.yml +4 -0
 - data/test/fixtures/reply.rb +18 -2
 - data/test/fixtures/reserved_words/distinct.yml +5 -0
 - data/test/fixtures/reserved_words/distincts_selects.yml +11 -0
 - data/test/fixtures/reserved_words/group.yml +14 -0
 - data/test/fixtures/reserved_words/select.yml +8 -0
 - data/test/fixtures/reserved_words/values.yml +7 -0
 - data/test/fixtures/ship.rb +3 -0
 - data/test/fixtures/ships.yml +5 -0
 - data/test/fixtures/subject.rb +4 -0
 - data/test/fixtures/subscriber.rb +4 -3
 - data/test/fixtures/tag.rb +7 -0
 - data/test/fixtures/tagging.rb +10 -0
 - data/test/fixtures/taggings.yml +25 -0
 - data/test/fixtures/tags.yml +7 -0
 - data/test/fixtures/task.rb +3 -0
 - data/test/fixtures/tasks.yml +7 -0
 - data/test/fixtures/topic.rb +20 -3
 - data/test/fixtures/topics.yml +22 -0
 - data/test/fixtures/treasure.rb +4 -0
 - data/test/fixtures/treasures.yml +10 -0
 - data/test/fixtures/vertex.rb +9 -0
 - data/test/fixtures/vertices.yml +4 -0
 - data/test/fixtures_test.rb +574 -8
 - data/test/inheritance_test.rb +113 -27
 - data/test/json_serialization_test.rb +180 -0
 - data/test/lifecycle_test.rb +56 -29
 - data/test/locking_test.rb +273 -0
 - data/test/method_scoping_test.rb +416 -0
 - data/test/migration_test.rb +933 -0
 - data/test/migration_test_firebird.rb +124 -0
 - data/test/mixin_test.rb +95 -0
 - data/test/modules_test.rb +23 -10
 - data/test/multiple_db_test.rb +17 -3
 - data/test/pk_test.rb +59 -15
 - data/test/query_cache_test.rb +104 -0
 - data/test/readonly_test.rb +107 -0
 - data/test/reflection_test.rb +124 -27
 - data/test/reserved_word_test_mysql.rb +177 -0
 - data/test/schema_authorization_test_postgresql.rb +75 -0
 - data/test/schema_dumper_test.rb +131 -0
 - data/test/schema_test_postgresql.rb +64 -0
 - data/test/serialization_test.rb +47 -0
 - data/test/synonym_test_oracle.rb +17 -0
 - data/test/table_name_test_sqlserver.rb +23 -0
 - data/test/threaded_connections_test.rb +48 -0
 - data/test/transactions_test.rb +227 -29
 - data/test/unconnected_test.rb +14 -6
 - data/test/validations_test.rb +1293 -32
 - data/test/xml_serialization_test.rb +202 -0
 - metadata +347 -143
 - data/dev-utils/eval_debugger.rb +0 -9
 - data/examples/associations.rb +0 -87
 - data/examples/shared_setup.rb +0 -15
 - data/examples/validation.rb +0 -88
 - data/lib/active_record/deprecated_associations.rb +0 -70
 - data/lib/active_record/support/class_attribute_accessors.rb +0 -43
 - data/lib/active_record/support/class_inheritable_attributes.rb +0 -37
 - data/lib/active_record/support/clean_logger.rb +0 -10
 - data/lib/active_record/support/inflector.rb +0 -70
 - data/lib/active_record/vendor/simple.rb +0 -702
 - data/lib/active_record/wrappers/yaml_wrapper.rb +0 -15
 - data/lib/active_record/wrappings.rb +0 -59
 - data/rakefile +0 -122
 - data/test/deprecated_associations_test.rb +0 -336
 - data/test/fixtures/accounts/signals37 +0 -3
 - data/test/fixtures/accounts/unknown +0 -2
 - data/test/fixtures/companies/first_client +0 -6
 - data/test/fixtures/companies/first_firm +0 -4
 - data/test/fixtures/companies/second_client +0 -6
 - data/test/fixtures/courses/java +0 -2
 - data/test/fixtures/courses/ruby +0 -2
 - data/test/fixtures/customers/david +0 -6
 - data/test/fixtures/db_definitions/mysql.sql +0 -96
 - data/test/fixtures/db_definitions/mysql2.sql +0 -4
 - data/test/fixtures/developers/david +0 -2
 - data/test/fixtures/developers/jamis +0 -2
 - data/test/fixtures/entrants/first +0 -3
 - data/test/fixtures/entrants/second +0 -3
 - data/test/fixtures/entrants/third +0 -3
 - data/test/fixtures/fixture_database.sqlite +0 -0
 - data/test/fixtures/fixture_database_2.sqlite +0 -0
 - data/test/fixtures/movies/first +0 -2
 - data/test/fixtures/movies/second +0 -2
 - data/test/fixtures/projects/action_controller +0 -2
 - data/test/fixtures/projects/active_record +0 -2
 - data/test/fixtures/topics/first +0 -9
 - data/test/fixtures/topics/second +0 -8
 - data/test/inflector_test.rb +0 -104
 - data/test/thread_safety_test.rb +0 -33
 
| 
         @@ -0,0 +1,222 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            CREATE TABLE accounts (
         
     | 
| 
      
 2 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 3 
     | 
    
         
            +
              firm_id int NULL,
         
     | 
| 
      
 4 
     | 
    
         
            +
              credit_limit int NULL
         
     | 
| 
      
 5 
     | 
    
         
            +
            )
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            CREATE TABLE funny_jokes (
         
     | 
| 
      
 8 
     | 
    
         
            +
            id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 9 
     | 
    
         
            +
              name varchar(50) NULL
         
     | 
| 
      
 10 
     | 
    
         
            +
            )
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            CREATE TABLE companies (
         
     | 
| 
      
 13 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 14 
     | 
    
         
            +
              type varchar(50) NULL,
         
     | 
| 
      
 15 
     | 
    
         
            +
              ruby_type varchar(50) NULL,
         
     | 
| 
      
 16 
     | 
    
         
            +
              firm_id int NULL,
         
     | 
| 
      
 17 
     | 
    
         
            +
              name varchar(50) NULL,
         
     | 
| 
      
 18 
     | 
    
         
            +
              client_of int NULL,
         
     | 
| 
      
 19 
     | 
    
         
            +
              rating int default 1
         
     | 
| 
      
 20 
     | 
    
         
            +
            )
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            CREATE TABLE topics (
         
     | 
| 
      
 24 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 25 
     | 
    
         
            +
              title varchar(255) NULL,
         
     | 
| 
      
 26 
     | 
    
         
            +
              author_name varchar(255) NULL,
         
     | 
| 
      
 27 
     | 
    
         
            +
              author_email_address varchar(255) NULL,
         
     | 
| 
      
 28 
     | 
    
         
            +
              written_on datetime NULL,
         
     | 
| 
      
 29 
     | 
    
         
            +
              bonus_time datetime NULL,
         
     | 
| 
      
 30 
     | 
    
         
            +
              last_read datetime NULL,
         
     | 
| 
      
 31 
     | 
    
         
            +
              content varchar(255) NULL,
         
     | 
| 
      
 32 
     | 
    
         
            +
              approved bit default 1,
         
     | 
| 
      
 33 
     | 
    
         
            +
              replies_count int default 0,
         
     | 
| 
      
 34 
     | 
    
         
            +
              parent_id int NULL,
         
     | 
| 
      
 35 
     | 
    
         
            +
              type varchar(50) NULL
         
     | 
| 
      
 36 
     | 
    
         
            +
            )
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            CREATE TABLE developers (
         
     | 
| 
      
 39 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 40 
     | 
    
         
            +
              name varchar(100) NULL,
         
     | 
| 
      
 41 
     | 
    
         
            +
              salary int default 70000,
         
     | 
| 
      
 42 
     | 
    
         
            +
              created_at datetime NULL,
         
     | 
| 
      
 43 
     | 
    
         
            +
              updated_at datetime NULL
         
     | 
| 
      
 44 
     | 
    
         
            +
            )
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            CREATE TABLE projects (
         
     | 
| 
      
 47 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 48 
     | 
    
         
            +
              name varchar(100) NULL,
         
     | 
| 
      
 49 
     | 
    
         
            +
              type varchar(255) NULL
         
     | 
| 
      
 50 
     | 
    
         
            +
            )
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            CREATE TABLE developers_projects (
         
     | 
| 
      
 53 
     | 
    
         
            +
              developer_id int NOT NULL,
         
     | 
| 
      
 54 
     | 
    
         
            +
              project_id int NOT NULL,
         
     | 
| 
      
 55 
     | 
    
         
            +
              joined_on datetime NULL,
         
     | 
| 
      
 56 
     | 
    
         
            +
              access_level smallint default 1
         
     | 
| 
      
 57 
     | 
    
         
            +
            )
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            CREATE TABLE orders (
         
     | 
| 
      
 60 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 61 
     | 
    
         
            +
              name varchar(100) NULL,
         
     | 
| 
      
 62 
     | 
    
         
            +
              billing_customer_id int NULL,
         
     | 
| 
      
 63 
     | 
    
         
            +
              shipping_customer_id int NULL
         
     | 
| 
      
 64 
     | 
    
         
            +
            )
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            CREATE TABLE customers (
         
     | 
| 
      
 67 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 68 
     | 
    
         
            +
              name varchar(100) NULL,
         
     | 
| 
      
 69 
     | 
    
         
            +
              balance int default 0,
         
     | 
| 
      
 70 
     | 
    
         
            +
              address_street varchar(100) NULL,
         
     | 
| 
      
 71 
     | 
    
         
            +
              address_city varchar(100) NULL,
         
     | 
| 
      
 72 
     | 
    
         
            +
              address_country varchar(100) NULL,
         
     | 
| 
      
 73 
     | 
    
         
            +
              gps_location varchar(100) NULL
         
     | 
| 
      
 74 
     | 
    
         
            +
            )
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            CREATE TABLE movies (
         
     | 
| 
      
 77 
     | 
    
         
            +
              movieid numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 78 
     | 
    
         
            +
              name varchar(100) NULL
         
     | 
| 
      
 79 
     | 
    
         
            +
            )
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            CREATE TABLE subscribers (
         
     | 
| 
      
 82 
     | 
    
         
            +
              nick varchar(100) PRIMARY KEY,
         
     | 
| 
      
 83 
     | 
    
         
            +
              name varchar(100) NULL
         
     | 
| 
      
 84 
     | 
    
         
            +
            )
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            CREATE TABLE booleantests (
         
     | 
| 
      
 87 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 88 
     | 
    
         
            +
              value int NULL
         
     | 
| 
      
 89 
     | 
    
         
            +
            )
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            CREATE TABLE auto_id_tests (
         
     | 
| 
      
 92 
     | 
    
         
            +
              auto_id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 93 
     | 
    
         
            +
              value int NULL
         
     | 
| 
      
 94 
     | 
    
         
            +
            )
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            CREATE TABLE entrants (
         
     | 
| 
      
 97 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 98 
     | 
    
         
            +
              name varchar(255) NOT NULL,
         
     | 
| 
      
 99 
     | 
    
         
            +
              course_id int NOT NULL
         
     | 
| 
      
 100 
     | 
    
         
            +
            )
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            CREATE TABLE colnametests (
         
     | 
| 
      
 103 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 104 
     | 
    
         
            +
              [references] int NOT NULL
         
     | 
| 
      
 105 
     | 
    
         
            +
            )
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
            CREATE TABLE mixins (
         
     | 
| 
      
 108 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 109 
     | 
    
         
            +
              parent_id int NULL,
         
     | 
| 
      
 110 
     | 
    
         
            +
              pos int NULL,
         
     | 
| 
      
 111 
     | 
    
         
            +
              created_at datetime NULL,
         
     | 
| 
      
 112 
     | 
    
         
            +
              updated_at datetime NULL,
         
     | 
| 
      
 113 
     | 
    
         
            +
              lft int NULL,
         
     | 
| 
      
 114 
     | 
    
         
            +
              rgt int NULL,
         
     | 
| 
      
 115 
     | 
    
         
            +
              root_id int NULL,
         
     | 
| 
      
 116 
     | 
    
         
            +
              type varchar(40) NULL
         
     | 
| 
      
 117 
     | 
    
         
            +
            )
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            CREATE TABLE people (
         
     | 
| 
      
 120 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 121 
     | 
    
         
            +
              first_name varchar(40) NULL,
         
     | 
| 
      
 122 
     | 
    
         
            +
              lock_version int DEFAULT 0
         
     | 
| 
      
 123 
     | 
    
         
            +
            )
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            CREATE TABLE readers (
         
     | 
| 
      
 126 
     | 
    
         
            +
                id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 127 
     | 
    
         
            +
                post_id int NOT NULL,
         
     | 
| 
      
 128 
     | 
    
         
            +
                person_id int NOT NULL
         
     | 
| 
      
 129 
     | 
    
         
            +
            )
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
            CREATE TABLE binaries (
         
     | 
| 
      
 132 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 133 
     | 
    
         
            +
              data image NULL
         
     | 
| 
      
 134 
     | 
    
         
            +
            )
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            CREATE TABLE computers (
         
     | 
| 
      
 137 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 138 
     | 
    
         
            +
              developer int NOT NULL,
         
     | 
| 
      
 139 
     | 
    
         
            +
              extendedWarranty int NOT NULL
         
     | 
| 
      
 140 
     | 
    
         
            +
            )
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
            CREATE TABLE posts (
         
     | 
| 
      
 143 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 144 
     | 
    
         
            +
              author_id int NULL,
         
     | 
| 
      
 145 
     | 
    
         
            +
              title varchar(255) NOT NULL,
         
     | 
| 
      
 146 
     | 
    
         
            +
              body varchar(2048) NOT NULL,
         
     | 
| 
      
 147 
     | 
    
         
            +
              type varchar(255) NOT NULL
         
     | 
| 
      
 148 
     | 
    
         
            +
            )
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
            CREATE TABLE comments (
         
     | 
| 
      
 151 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 152 
     | 
    
         
            +
              post_id int NOT NULL,
         
     | 
| 
      
 153 
     | 
    
         
            +
              body varchar(2048) NOT NULL,
         
     | 
| 
      
 154 
     | 
    
         
            +
              type varchar(255) NOT NULL
         
     | 
| 
      
 155 
     | 
    
         
            +
            )
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
            CREATE TABLE authors (
         
     | 
| 
      
 158 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 159 
     | 
    
         
            +
              name varchar(255) NOT NULL
         
     | 
| 
      
 160 
     | 
    
         
            +
            )
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
            CREATE TABLE tasks (
         
     | 
| 
      
 163 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 164 
     | 
    
         
            +
              starting datetime NULL,
         
     | 
| 
      
 165 
     | 
    
         
            +
              ending datetime NULL
         
     | 
| 
      
 166 
     | 
    
         
            +
            )
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
            CREATE TABLE categories (
         
     | 
| 
      
 169 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 170 
     | 
    
         
            +
              name varchar(255) NOT NULL,
         
     | 
| 
      
 171 
     | 
    
         
            +
              type varchar(255) NOT NULL
         
     | 
| 
      
 172 
     | 
    
         
            +
            )
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
            CREATE TABLE categories_posts (
         
     | 
| 
      
 175 
     | 
    
         
            +
              category_id int NOT NULL,
         
     | 
| 
      
 176 
     | 
    
         
            +
              post_id int NOT NULL
         
     | 
| 
      
 177 
     | 
    
         
            +
            )
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
            CREATE TABLE fk_test_has_pk (
         
     | 
| 
      
 180 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY
         
     | 
| 
      
 181 
     | 
    
         
            +
            )
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
            CREATE TABLE fk_test_has_fk (
         
     | 
| 
      
 184 
     | 
    
         
            +
              id    numeric(9,0) PRIMARY KEY,
         
     | 
| 
      
 185 
     | 
    
         
            +
              fk_id numeric(9,0) NOT NULL,
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
              FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id)
         
     | 
| 
      
 188 
     | 
    
         
            +
            )
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
            CREATE TABLE keyboards (
         
     | 
| 
      
 192 
     | 
    
         
            +
              key_number numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 193 
     | 
    
         
            +
              name varchar(50) NULL
         
     | 
| 
      
 194 
     | 
    
         
            +
            )
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
            --This table has an altered lock_version column name.
         
     | 
| 
      
 197 
     | 
    
         
            +
            CREATE TABLE legacy_things (
         
     | 
| 
      
 198 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 199 
     | 
    
         
            +
              tps_report_number int default NULL,
         
     | 
| 
      
 200 
     | 
    
         
            +
              version int default 0
         
     | 
| 
      
 201 
     | 
    
         
            +
            )
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
            CREATE TABLE numeric_data (
         
     | 
| 
      
 205 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 206 
     | 
    
         
            +
              bank_balance numeric(10,2),
         
     | 
| 
      
 207 
     | 
    
         
            +
              big_bank_balance numeric(15,2),
         
     | 
| 
      
 208 
     | 
    
         
            +
              world_population numeric(10),
         
     | 
| 
      
 209 
     | 
    
         
            +
              my_house_population numeric(2),
         
     | 
| 
      
 210 
     | 
    
         
            +
              decimal_number_with_default numeric(3,2) DEFAULT 2.78
         
     | 
| 
      
 211 
     | 
    
         
            +
            )
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
            CREATE TABLE mixed_case_monkeys (
         
     | 
| 
      
 214 
     | 
    
         
            +
              [monkeyID] numeric(9,0) IDENTITY PRIMARY KEY,
         
     | 
| 
      
 215 
     | 
    
         
            +
              [fleaCount] numeric(9,0)
         
     | 
| 
      
 216 
     | 
    
         
            +
            );
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
            CREATE TABLE minimalistics (
         
     | 
| 
      
 219 
     | 
    
         
            +
              id numeric(9,0) IDENTITY PRIMARY KEY
         
     | 
| 
      
 220 
     | 
    
         
            +
            );
         
     | 
| 
      
 221 
     | 
    
         
            +
             
     | 
| 
      
 222 
     | 
    
         
            +
            go
         
     | 
    
        data/test/fixtures/developer.rb
    CHANGED
    
    | 
         @@ -1,8 +1,72 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
      
 1 
     | 
    
         
            +
            module DeveloperProjectsAssociationExtension
         
     | 
| 
      
 2 
     | 
    
         
            +
              def find_most_recent
         
     | 
| 
      
 3 
     | 
    
         
            +
                find(:first, :order => "id DESC")
         
     | 
| 
      
 4 
     | 
    
         
            +
              end
         
     | 
| 
      
 5 
     | 
    
         
            +
            end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module DeveloperProjectsAssociationExtension2
         
     | 
| 
      
 8 
     | 
    
         
            +
              def find_least_recent
         
     | 
| 
      
 9 
     | 
    
         
            +
                find(:first, :order => "id ASC")
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
       3 
12 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            class Developer < ActiveRecord::Base
         
     | 
| 
      
 14 
     | 
    
         
            +
              has_and_belongs_to_many :projects do
         
     | 
| 
      
 15 
     | 
    
         
            +
                def find_most_recent
         
     | 
| 
      
 16 
     | 
    
         
            +
                  find(:first, :order => "id DESC")
         
     | 
| 
       7 
17 
     | 
    
         
             
                end
         
     | 
| 
       8 
     | 
    
         
            -
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
              
         
     | 
| 
      
 20 
     | 
    
         
            +
              has_and_belongs_to_many :projects_extended_by_name, 
         
     | 
| 
      
 21 
     | 
    
         
            +
                  :class_name => "Project", 
         
     | 
| 
      
 22 
     | 
    
         
            +
                  :join_table => "developers_projects", 
         
     | 
| 
      
 23 
     | 
    
         
            +
                  :association_foreign_key => "project_id",
         
     | 
| 
      
 24 
     | 
    
         
            +
                  :extend => DeveloperProjectsAssociationExtension
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              has_and_belongs_to_many :projects_extended_by_name_twice, 
         
     | 
| 
      
 27 
     | 
    
         
            +
                  :class_name => "Project", 
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :join_table => "developers_projects", 
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :association_foreign_key => "project_id",
         
     | 
| 
      
 30 
     | 
    
         
            +
                  :extend => [DeveloperProjectsAssociationExtension, DeveloperProjectsAssociationExtension2]
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              has_and_belongs_to_many :projects_extended_by_name_and_block, 
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :class_name => "Project", 
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :join_table => "developers_projects", 
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :association_foreign_key => "project_id",
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :extend => DeveloperProjectsAssociationExtension do
         
     | 
| 
      
 37 
     | 
    
         
            +
                    def find_least_recent
         
     | 
| 
      
 38 
     | 
    
         
            +
                      find(:first, :order => "id ASC")
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              has_and_belongs_to_many :special_projects, :join_table => 'developers_projects', :association_foreign_key => 'project_id'
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              has_many :audit_logs
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              validates_inclusion_of :salary, :in => 50000..200000
         
     | 
| 
      
 47 
     | 
    
         
            +
              validates_length_of    :name, :within => 3..20
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              before_create do |developer|
         
     | 
| 
      
 50 
     | 
    
         
            +
                developer.audit_logs.build :message => "Computer created"
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
            end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            class AuditLog < ActiveRecord::Base
         
     | 
| 
      
 55 
     | 
    
         
            +
              belongs_to :developer
         
     | 
| 
      
 56 
     | 
    
         
            +
            end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            DeveloperSalary = Struct.new(:amount)
         
     | 
| 
      
 59 
     | 
    
         
            +
            class DeveloperWithAggregate < ActiveRecord::Base
         
     | 
| 
      
 60 
     | 
    
         
            +
              self.table_name = 'developers'
         
     | 
| 
      
 61 
     | 
    
         
            +
              composed_of :salary, :class_name => 'DeveloperSalary', :mapping => [%w(salary amount)]
         
     | 
| 
      
 62 
     | 
    
         
            +
            end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base
         
     | 
| 
      
 65 
     | 
    
         
            +
              self.table_name = 'developers'
         
     | 
| 
      
 66 
     | 
    
         
            +
              has_and_belongs_to_many :projects, :join_table => 'developers_projects', :foreign_key => 'developer_id'
         
     | 
| 
      
 67 
     | 
    
         
            +
              before_destroy :raise_if_projects_empty!
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              def raise_if_projects_empty!
         
     | 
| 
      
 70 
     | 
    
         
            +
                raise if projects.empty?
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            david:
         
     | 
| 
      
 2 
     | 
    
         
            +
              id: 1
         
     | 
| 
      
 3 
     | 
    
         
            +
              name: David
         
     | 
| 
      
 4 
     | 
    
         
            +
              salary: 80000
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            jamis:
         
     | 
| 
      
 7 
     | 
    
         
            +
              id: 2
         
     | 
| 
      
 8 
     | 
    
         
            +
              name: Jamis
         
     | 
| 
      
 9 
     | 
    
         
            +
              salary: 150000
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            <% for digit in 3..10 %>
         
     | 
| 
      
 12 
     | 
    
         
            +
            dev_<%= digit %>:
         
     | 
| 
      
 13 
     | 
    
         
            +
              id: <%= digit %>
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: fixture_<%= digit %>
         
     | 
| 
      
 15 
     | 
    
         
            +
              salary: 100000
         
     | 
| 
      
 16 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            poor_jamis:
         
     | 
| 
      
 19 
     | 
    
         
            +
              id: 11
         
     | 
| 
      
 20 
     | 
    
         
            +
              name: Jamis
         
     | 
| 
      
 21 
     | 
    
         
            +
              salary: 9000
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            david_action_controller:
         
     | 
| 
      
 2 
     | 
    
         
            +
              developer_id: 1
         
     | 
| 
      
 3 
     | 
    
         
            +
              project_id: 2
         
     | 
| 
      
 4 
     | 
    
         
            +
              joined_on: 2004-10-10
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            david_active_record:
         
     | 
| 
      
 7 
     | 
    
         
            +
              developer_id: 1
         
     | 
| 
      
 8 
     | 
    
         
            +
              project_id: 1
         
     | 
| 
      
 9 
     | 
    
         
            +
              joined_on: 2004-10-10
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            jamis_active_record:
         
     | 
| 
      
 12 
     | 
    
         
            +
              developer_id: 2
         
     | 
| 
      
 13 
     | 
    
         
            +
              project_id: 1
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            poor_jamis_active_record:
         
     | 
| 
      
 16 
     | 
    
         
            +
              developer_id: 11
         
     | 
| 
      
 17 
     | 
    
         
            +
              project_id: 1
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Logfile created on Wed Oct 31 16:05:13 +0000 2007 by logger.rb/1.5.2.9
         
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class InnocentJointable < ActiveRecord::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def self.up
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table("people_reminders", :id => false) do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.column :reminder_id, :integer
         
     | 
| 
      
 5 
     | 
    
         
            +
                  t.column :person_id, :integer
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.down
         
     | 
| 
      
 10 
     | 
    
         
            +
                drop_table "people_reminders"
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class GiveMeBigNumbers < ActiveRecord::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def self.up
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table :big_numbers do |table|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  table.column :bank_balance, :decimal, :precision => 10, :scale => 2
         
     | 
| 
      
 5 
     | 
    
         
            +
                  table.column :big_bank_balance, :decimal, :precision => 15, :scale => 2
         
     | 
| 
      
 6 
     | 
    
         
            +
                  table.column :world_population, :decimal, :precision => 10
         
     | 
| 
      
 7 
     | 
    
         
            +
                  table.column :my_house_population, :decimal, :precision => 2
         
     | 
| 
      
 8 
     | 
    
         
            +
                  table.column :value_of_e, :decimal
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def self.down
         
     | 
| 
      
 13 
     | 
    
         
            +
                drop_table :big_numbers
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class InnocentJointable < ActiveRecord::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def self.up
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table("people_reminders", :id => false) do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.column :reminder_id, :integer
         
     | 
| 
      
 5 
     | 
    
         
            +
                  t.column :person_id, :integer
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.down
         
     | 
| 
      
 10 
     | 
    
         
            +
                drop_table "people_reminders"
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class InnocentJointable < ActiveRecord::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def self.up
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table("people_reminders", :id => false) do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.column :reminder_id, :integer
         
     | 
| 
      
 5 
     | 
    
         
            +
                  t.column :person_id, :integer
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.down
         
     | 
| 
      
 10 
     | 
    
         
            +
                drop_table "people_reminders"
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Nested set mixins
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            <% (1..10).each do |counter| %>  
         
     | 
| 
      
 4 
     | 
    
         
            +
            set_<%= counter %>:
         
     | 
| 
      
 5 
     | 
    
         
            +
              id: <%= counter+3000 %>
         
     | 
| 
      
 6 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # Big old set
         
     | 
| 
      
 9 
     | 
    
         
            +
            <%
         
     | 
| 
      
 10 
     | 
    
         
            +
            [[4001, 0, 1, 20],
         
     | 
| 
      
 11 
     | 
    
         
            +
              [4002, 4001, 2, 7],
         
     | 
| 
      
 12 
     | 
    
         
            +
              [4003, 4002, 3, 4],
         
     | 
| 
      
 13 
     | 
    
         
            +
              [4004, 4002, 5, 6],
         
     | 
| 
      
 14 
     | 
    
         
            +
              [4005, 4001, 14, 13],
         
     | 
| 
      
 15 
     | 
    
         
            +
              [4006, 4005, 9, 10],
         
     | 
| 
      
 16 
     | 
    
         
            +
              [4007, 4005, 11, 12],
         
     | 
| 
      
 17 
     | 
    
         
            +
              [4008, 4001, 8, 19],
         
     | 
| 
      
 18 
     | 
    
         
            +
              [4009, 4008, 15, 16],
         
     | 
| 
      
 19 
     | 
    
         
            +
              [4010, 4008, 17, 18]].each do |set| %>
         
     | 
| 
      
 20 
     | 
    
         
            +
            tree_<%= set[0] %>:
         
     | 
| 
      
 21 
     | 
    
         
            +
              id: <%= set[0]%>
         
     | 
| 
      
 22 
     | 
    
         
            +
              parent_id: <%= set[1]%>
         
     | 
| 
      
 23 
     | 
    
         
            +
              type: NestedSetWithStringScope
         
     | 
| 
      
 24 
     | 
    
         
            +
              lft: <%= set[2]%>
         
     | 
| 
      
 25 
     | 
    
         
            +
              rgt: <%= set[3]%>
         
     | 
| 
      
 26 
     | 
    
         
            +
              root_id: 42
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     |