magic_model_generator 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/License.txt +20 -0
- data/Manifest.txt +81 -0
- data/{README → README.txt} +0 -0
- data/Rakefile +58 -59
- data/lib/activerecord/base.rb +0 -2
- data/lib/magic_model_generator.rb +0 -2
- data/lib/magic_model_generator/schema.rb +1 -5
- data/lib/magic_model_generator/validations.rb +1 -0
- data/lib/magic_model_generator/version.rb +1 -1
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/tasks/build_db.rake +85 -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 +27 -0
- 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 +23 -0
- data/test/connections/native_sqlite/connection.rb +25 -0
- data/test/connections/native_sqlite3/connection.rb +25 -0
- data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/test/connections/native_sqlserver/connection.rb +23 -0
- data/test/connections/native_sqlserver_odbc/connection.rb +25 -0
- data/test/connections/native_sybase/connection.rb +23 -0
- data/test/fixtures/db_definitions/db2.drop.sql +32 -0
- data/test/fixtures/db_definitions/db2.sql +231 -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 +63 -0
- data/test/fixtures/db_definitions/firebird.sql +304 -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 +32 -0
- data/test/fixtures/db_definitions/frontbase.sql +268 -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/mysql.drop.sql +32 -0
- data/test/fixtures/db_definitions/mysql.sql +234 -0
- data/test/fixtures/db_definitions/mysql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/mysql2.sql +5 -0
- data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase.sql +302 -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 +65 -0
- data/test/fixtures/db_definitions/oracle.sql +325 -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 +37 -0
- data/test/fixtures/db_definitions/postgresql.sql +247 -0
- data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/postgresql2.sql +4 -0
- data/test/fixtures/db_definitions/schema.rb +74 -0
- data/test/fixtures/db_definitions/sqlite.drop.sql +32 -0
- data/test/fixtures/db_definitions/sqlite.sql +215 -0
- data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
- data/test/fixtures/db_definitions/sqlite2.sql +5 -0
- data/test/fixtures/db_definitions/sqlserver.drop.sql +34 -0
- data/test/fixtures/db_definitions/sqlserver.sql +243 -0
- data/test/fixtures/db_definitions/sqlserver2.drop.sql +2 -0
- data/test/fixtures/db_definitions/sqlserver2.sql +5 -0
- data/test/fixtures/db_definitions/sybase.drop.sql +34 -0
- data/test/fixtures/db_definitions/sybase.sql +218 -0
- data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
- data/test/fixtures/db_definitions/sybase2.sql +5 -0
- data/test/{magic_model_generator_test.rb → test_magic_model_generator.rb} +1 -1
- data/test/test_rails_app/test/test_helper.rb +36 -0
- data/website/index.html +165 -0
- data/website/index.txt +83 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.js +3 -0
- data/website/template.rhtml +53 -0
- metadata +96 -329
- data/examples/singleview/account.rb +0 -94
- data/examples/singleview/account_history.rb +0 -21
- data/examples/singleview/account_reservation.rb +0 -26
- data/examples/singleview/account_type.rb +0 -54
- data/examples/singleview/account_type_aging.rb +0 -17
- data/examples/singleview/account_type_variable.rb +0 -8
- data/examples/singleview/address.rb +0 -8
- data/examples/singleview/address_format.rb +0 -49
- data/examples/singleview/address_history.rb +0 -28
- data/examples/singleview/adjustment.rb +0 -97
- data/examples/singleview/adjustment_batch.rb +0 -42
- data/examples/singleview/adjustment_invoice.rb +0 -17
- data/examples/singleview/adjustment_type.rb +0 -54
- data/examples/singleview/adjustment_type_variable.rb +0 -8
- data/examples/singleview/archive_lock_t.rb +0 -11
- data/examples/singleview/archive_result.rb +0 -15
- data/examples/singleview/archive_type.rb +0 -31
- data/examples/singleview/archive_type_table_list.rb +0 -15
- data/examples/singleview/atai_error_name.rb +0 -7
- data/examples/singleview/atlanta_form.rb +0 -23
- data/examples/singleview/atlanta_form_field.rb +0 -12
- data/examples/singleview/atlanta_group.rb +0 -285
- data/examples/singleview/atlanta_help_entry.rb +0 -32
- data/examples/singleview/atlanta_operator.rb +0 -356
- data/examples/singleview/atlanta_profile.rb +0 -47
- data/examples/singleview/atlanta_profile_func_map.rb +0 -8
- data/examples/singleview/atlanta_profile_group_map.rb +0 -10
- data/examples/singleview/atlanta_profile_role_map.rb +0 -8
- data/examples/singleview/atlanta_profile_wf_map.rb +0 -10
- data/examples/singleview/atlanta_role.rb +0 -23
- data/examples/singleview/atlanta_table_partition.rb +0 -39
- data/examples/singleview/attribute_type.rb +0 -75
- data/examples/singleview/attribute_type_variable.rb +0 -8
- data/examples/singleview/bill_run.rb +0 -93
- data/examples/singleview/bill_run_operation.rb +0 -54
- data/examples/singleview/bill_run_type.rb +0 -39
- data/examples/singleview/bill_run_type_status.rb +0 -12
- data/examples/singleview/bill_run_type_task.rb +0 -12
- data/examples/singleview/cache.rb +0 -23
- data/examples/singleview/cache_field.rb +0 -13
- data/examples/singleview/can_act_charge.rb +0 -16
- data/examples/singleview/charge.rb +0 -67
- data/examples/singleview/charge_category.rb +0 -45
- data/examples/singleview/charge_output_defn.rb +0 -13
- data/examples/singleview/charge_output_defn_history.rb +0 -22
- data/examples/singleview/charge_output_defn_var.rb +0 -10
- data/examples/singleview/configuration_attr_type.rb +0 -22
- data/examples/singleview/configuration_attribute.rb +0 -11
- data/examples/singleview/configuration_item.rb +0 -26
- data/examples/singleview/configuration_item_type.rb +0 -29
- data/examples/singleview/contract.rb +0 -35
- data/examples/singleview/contract_history.rb +0 -48
- data/examples/singleview/contract_type.rb +0 -58
- data/examples/singleview/contract_type_product.rb +0 -11
- data/examples/singleview/conversion_rate.rb +0 -14
- data/examples/singleview/currency.rb +0 -118
- data/examples/singleview/currency_history.rb +0 -28
- data/examples/singleview/customer_contact.rb +0 -12
- data/examples/singleview/customer_node.rb +0 -166
- data/examples/singleview/customer_node_bill_run.rb +0 -12
- data/examples/singleview/customer_node_charge_cat.rb +0 -22
- data/examples/singleview/customer_node_correspond.rb +0 -12
- data/examples/singleview/customer_node_da.rb +0 -11
- data/examples/singleview/customer_node_da_array.rb +0 -35
- data/examples/singleview/customer_node_history.rb +0 -86
- data/examples/singleview/customer_node_inv_format.rb +0 -33
- data/examples/singleview/customer_node_type.rb +0 -89
- data/examples/singleview/customer_node_type_cc.rb +0 -18
- data/examples/singleview/customer_node_type_da.rb +0 -8
- data/examples/singleview/customer_node_type_var.rb +0 -8
- data/examples/singleview/customer_query.rb +0 -80
- data/examples/singleview/customer_query_progress.rb +0 -20
- data/examples/singleview/customer_query_type.rb +0 -49
- data/examples/singleview/customer_query_type_var.rb +0 -8
- data/examples/singleview/delete_cascade.rb +0 -13
- data/examples/singleview/delete_cascade_group.rb +0 -21
- data/examples/singleview/delete_constraint.rb +0 -9
- data/examples/singleview/derived_attribute.rb +0 -32
- data/examples/singleview/derived_attribute_array.rb +0 -32
- data/examples/singleview/derived_attribute_history.rb +0 -41
- data/examples/singleview/derived_attribute_index.rb +0 -13
- data/examples/singleview/derived_attribute_value.rb +0 -19
- data/examples/singleview/dil.rb +0 -18
- data/examples/singleview/dil_history.rb +0 -24
- data/examples/singleview/dil_reference.rb +0 -9
- data/examples/singleview/dil_validation_t.rb +0 -6
- data/examples/singleview/dil_variable.rb +0 -10
- data/examples/singleview/dunning_t.rb +0 -14
- data/examples/singleview/entity_mapping.rb +0 -11
- data/examples/singleview/entity_remap.rb +0 -22
- data/examples/singleview/entity_validation.rb +0 -70
- data/examples/singleview/entity_validation_list.rb +0 -15
- data/examples/singleview/entity_validation_variable.rb +0 -8
- data/examples/singleview/equipment.rb +0 -28
- data/examples/singleview/equipment_history.rb +0 -62
- data/examples/singleview/equipment_type.rb +0 -57
- data/examples/singleview/equipment_type_variable.rb +0 -8
- data/examples/singleview/error_group.rb +0 -18
- data/examples/singleview/error_message.rb +0 -65
- data/examples/singleview/evs_address_equiv.rb +0 -17
- data/examples/singleview/evs_alias.rb +0 -12
- data/examples/singleview/evs_attribute_type_key.rb +0 -7
- data/examples/singleview/evt_equipment_changeover.rb +0 -9
- data/examples/singleview/expression_list.rb +0 -27
- data/examples/singleview/expression_list_value.rb +0 -17
- data/examples/singleview/fac_group_compatibility.rb +0 -11
- data/examples/singleview/fac_group_instance.rb +0 -19
- data/examples/singleview/fac_group_instance_hist.rb +0 -16
- data/examples/singleview/facility.rb +0 -9
- data/examples/singleview/facility_group.rb +0 -21
- data/examples/singleview/facility_group_history.rb +0 -21
- data/examples/singleview/foreign_key.rb +0 -9
- data/examples/singleview/function_defn.rb +0 -16
- data/examples/singleview/function_defn_history.rb +0 -35
- data/examples/singleview/function_role.rb +0 -24
- data/examples/singleview/function_role_map.rb +0 -10
- data/examples/singleview/gl_code.rb +0 -65
- data/examples/singleview/gl_code_history.rb +0 -20
- data/examples/singleview/gl_upload.rb +0 -10
- data/examples/singleview/icon.rb +0 -64
- data/examples/singleview/inv_loop_t.rb +0 -4
- data/examples/singleview/inv_report_accounts_t.rb +0 -25
- data/examples/singleview/invoice.rb +0 -134
- data/examples/singleview/invoice_contents.rb +0 -14
- data/examples/singleview/invoice_format.rb +0 -31
- data/examples/singleview/invoice_format_history.rb +0 -29
- data/examples/singleview/invoice_message.rb +0 -17
- data/examples/singleview/invoice_message_history.rb +0 -31
- data/examples/singleview/invoice_message_variable.rb +0 -10
- data/examples/singleview/invoice_receivable_type.rb +0 -13
- data/examples/singleview/invoice_type.rb +0 -23
- data/examples/singleview/invoice_type_history.rb +0 -26
- data/examples/singleview/invoice_type_variable.rb +0 -10
- data/examples/singleview/isp_email_address.rb +0 -17
- data/examples/singleview/licence_current_values.rb +0 -12
- data/examples/singleview/menu_role_map.rb +0 -10
- data/examples/singleview/normalised_event.rb +0 -119
- data/examples/singleview/normalised_event_error.rb +0 -91
- data/examples/singleview/normalised_event_file.rb +0 -75
- data/examples/singleview/normalised_event_ft.rb +0 -18
- data/examples/singleview/normalised_event_ft_hist.rb +0 -25
- data/examples/singleview/normalised_event_ft_var.rb +0 -10
- data/examples/singleview/normalised_event_type.rb +0 -54
- data/examples/singleview/output_device.rb +0 -37
- data/examples/singleview/output_method.rb +0 -32
- data/examples/singleview/output_method_type.rb +0 -38
- data/examples/singleview/output_select.rb +0 -17
- data/examples/singleview/payment.rb +0 -102
- data/examples/singleview/payment_batch.rb +0 -43
- data/examples/singleview/payment_invoice.rb +0 -17
- data/examples/singleview/payment_item.rb +0 -15
- data/examples/singleview/payment_type.rb +0 -57
- data/examples/singleview/payment_type_variable.rb +0 -8
- data/examples/singleview/person.rb +0 -60
- data/examples/singleview/person_history.rb +0 -69
- data/examples/singleview/person_type.rb +0 -39
- data/examples/singleview/plan_table.rb +0 -27
- data/examples/singleview/product.rb +0 -45
- data/examples/singleview/product_compatibility.rb +0 -13
- data/examples/singleview/product_derived_attribute.rb +0 -10
- data/examples/singleview/product_facility_group.rb +0 -16
- data/examples/singleview/product_group.rb +0 -12
- data/examples/singleview/product_group_history.rb +0 -20
- data/examples/singleview/product_history.rb +0 -35
- data/examples/singleview/product_in_product_group.rb +0 -12
- data/examples/singleview/product_instance.rb +0 -41
- data/examples/singleview/product_instance_equip.rb +0 -21
- data/examples/singleview/product_instance_history.rb +0 -37
- data/examples/singleview/product_instance_service.rb +0 -17
- data/examples/singleview/product_payment_item.rb +0 -19
- data/examples/singleview/product_service_type.rb +0 -32
- data/examples/singleview/product_service_type_equip.rb +0 -20
- data/examples/singleview/product_subtotal.rb +0 -14
- data/examples/singleview/product_tariff.rb +0 -16
- data/examples/singleview/racr_clec_t1.rb +0 -12
- data/examples/singleview/racr_clec_t2.rb +0 -12
- data/examples/singleview/racr_clec_t3.rb +0 -28
- data/examples/singleview/racr_t.rb +0 -29
- data/examples/singleview/ragd_clec_t.rb +0 -47
- data/examples/singleview/ragd_t.rb +0 -28
- data/examples/singleview/rapc_t.rb +0 -27
- data/examples/singleview/rdfd_cmn_t.rb +0 -17
- data/examples/singleview/rdfd_t.rb +0 -16
- data/examples/singleview/receivable_type.rb +0 -49
- data/examples/singleview/receivable_type_history.rb +0 -25
- data/examples/singleview/reference_code.rb +0 -17
- data/examples/singleview/reference_type.rb +0 -32
- data/examples/singleview/release_info.rb +0 -10
- data/examples/singleview/report_reference_type.rb +0 -14
- data/examples/singleview/report_reference_type_defs.rb +0 -12
- data/examples/singleview/reprocessed_file.rb +0 -32
- data/examples/singleview/rgp_file.rb +0 -22
- data/examples/singleview/rgp_normalised_event.rb +0 -78
- data/examples/singleview/rmag_t.rb +0 -32
- data/examples/singleview/rpmr_t.rb +0 -27
- data/examples/singleview/rpsi_t.rb +0 -24
- data/examples/singleview/rser_t.rb +0 -13
- data/examples/singleview/rshu_cmn_t.rb +0 -31
- data/examples/singleview/schedule.rb +0 -91
- data/examples/singleview/schedule_task_type.rb +0 -43
- data/examples/singleview/service.rb +0 -88
- data/examples/singleview/service_bill_run_t.rb +0 -12
- data/examples/singleview/service_charge_category.rb +0 -22
- data/examples/singleview/service_da.rb +0 -11
- data/examples/singleview/service_da_array.rb +0 -35
- data/examples/singleview/service_duplicate.rb +0 -4
- data/examples/singleview/service_history.rb +0 -59
- data/examples/singleview/service_type.rb +0 -54
- data/examples/singleview/service_type_cc.rb +0 -18
- data/examples/singleview/service_type_da.rb +0 -8
- data/examples/singleview/service_type_equip_type.rb +0 -11
- data/examples/singleview/subtotal.rb +0 -48
- data/examples/singleview/subtotal_history.rb +0 -59
- data/examples/singleview/subtotal_rating_delta.rb +0 -20
- data/examples/singleview/subtotal_rating_value.rb +0 -21
- data/examples/singleview/subtotal_term.rb +0 -16
- data/examples/singleview/subtotal_value.rb +0 -18
- data/examples/singleview/summary_of_change.rb +0 -31
- data/examples/singleview/summary_of_change_ev.rb +0 -18
- data/examples/singleview/summary_of_change_view.rb +0 -22
- data/examples/singleview/t2_anumber_france.rb +0 -22
- data/examples/singleview/t2_anumber_italy.rb +0 -22
- data/examples/singleview/t2_anumber_netherlands.rb +0 -24
- data/examples/singleview/t2_anumber_portugal.rb +0 -22
- data/examples/singleview/t2_anumber_spain.rb +0 -22
- data/examples/singleview/t2_anumber_switzerland.rb +0 -24
- data/examples/singleview/t2_bankreference_austria.rb +0 -7
- data/examples/singleview/t2_bankreference_belgium.rb +0 -6
- data/examples/singleview/t2_bankreference_france.rb +0 -7
- data/examples/singleview/t2_bankreference_germany.rb +0 -7
- data/examples/singleview/t2_bankreference_italy.rb +0 -7
- data/examples/singleview/t2_bankreference_portugal.rb +0 -7
- data/examples/singleview/t2_cc_provrequests.rb +0 -19
- data/examples/singleview/t2_emf_info.rb +0 -12
- data/examples/singleview/t2_ev_column_label_mapping.rb +0 -9
- data/examples/singleview/t2_historytable.rb +0 -26
- data/examples/singleview/t2_inv_revoked_invoice.rb +0 -11
- data/examples/singleview/t2_inv_suppress_invoice.rb +0 -13
- data/examples/singleview/t2_national_number_plan.rb +0 -8
- data/examples/singleview/t2_pay_statement.rb +0 -28
- data/examples/singleview/t2_prov_req_action.rb +0 -22
- data/examples/singleview/t2_prov_request.rb +0 -32
- data/examples/singleview/t2_rep_brr_t.rb +0 -19
- data/examples/singleview/t2_rep_trr_t.rb +0 -19
- data/examples/singleview/t2_rep_ubr_t.rb +0 -19
- data/examples/singleview/t2_taxclass.rb +0 -8
- data/examples/singleview/t2_zipcode_austria.rb +0 -8
- data/examples/singleview/t2_zipcode_france.rb +0 -8
- data/examples/singleview/t2_zipcode_germany.rb +0 -8
- data/examples/singleview/t2_zipcode_hungary.rb +0 -8
- data/examples/singleview/t2_zipcode_luxembourg.rb +0 -8
- data/examples/singleview/t2_zipcode_netherlands.rb +0 -8
- data/examples/singleview/t2_zipcode_portugal.rb +0 -9
- data/examples/singleview/t2_zipcode_spain.rb +0 -8
- data/examples/singleview/t2_zipcode_switzerland.rb +0 -8
- data/examples/singleview/table_import_order.rb +0 -6
- data/examples/singleview/tariff.rb +0 -51
- data/examples/singleview/tariff_charge.rb +0 -33
- data/examples/singleview/tariff_charge_defn.rb +0 -18
- data/examples/singleview/tariff_condition_defn.rb +0 -19
- data/examples/singleview/tariff_history.rb +0 -70
- data/examples/singleview/tariff_recurring.rb +0 -36
- data/examples/singleview/task_queue.rb +0 -130
- data/examples/singleview/task_queue_result.rb +0 -10
- data/examples/singleview/template.rb +0 -18
- data/examples/singleview/template_history.rb +0 -30
- data/examples/singleview/template_reference.rb +0 -9
- data/examples/singleview/template_variable.rb +0 -10
- data/examples/singleview/trt_clec_treatment.rb +0 -13
- data/examples/singleview/variable_defn.rb +0 -48
- data/examples/singleview/variable_defn_dependency.rb +0 -11
- data/examples/singleview/variable_defn_direct.rb +0 -15
- data/examples/singleview/variable_defn_history.rb +0 -22
- data/examples/singleview/work_force.rb +0 -25
- data/examples/singleview/xpsi_addr_val_commtax21.rb +0 -24
- data/examples/singleview/xpsi_addr_val_msag.rb +0 -24
- data/examples/singleview/xpsi_addr_val_zip.rb +0 -14
- data/examples/singleview/xpsi_ne_batch.rb +0 -20
- data/examples/singleview/xpsi_product_batch.rb +0 -18
- data/examples/singleview/xpsi_product_status.rb +0 -14
- data/examples/singleview/xpsi_tax_error.rb +0 -34
- data/examples/singleview/xpsi_trt_revoke.rb +0 -68
- data/examples/singleview/xpsi_trt_revoke_prod_inst.rb +0 -12
- data/examples/singleview/xpsi_update_capture.rb +0 -35
data/tasks/build_db.rake
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
for adapter in %w( mysql postgresql sqlite sqlite3 firebird sqlserver sqlserver_odbc db2 oracle sybase openbase frontbase )
|
2
|
+
Rake::TestTask.new("test_#{adapter}") { |t|
|
3
|
+
t.libs << "test" << "test/connections/native_#{adapter}"
|
4
|
+
adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z]+/]
|
5
|
+
t.pattern = "test/**/test_*}.rb"
|
6
|
+
t.verbose = true
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
SCHEMA_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', *%w(test fixtures db_definitions)))
|
11
|
+
|
12
|
+
desc 'Build the MySQL test databases'
|
13
|
+
task :build_mysql_databases do
|
14
|
+
%x( mysqladmin create activerecord_unittest )
|
15
|
+
%x( mysqladmin create activerecord_unittest2 )
|
16
|
+
%x( mysql -e "grant all on activerecord_unittest.* to rails@localhost" )
|
17
|
+
%x( mysql -e "grant all on activerecord_unittest2.* to rails@localhost" )
|
18
|
+
%x( mysql activerecord_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} )
|
19
|
+
%x( mysql activerecord_unittest < #{File.join(SCHEMA_PATH, 'mysql2.sql')} )
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Drop the MySQL test databases'
|
23
|
+
task :drop_mysql_databases do
|
24
|
+
%x( mysqladmin -f drop activerecord_unittest )
|
25
|
+
%x( mysqladmin -f drop activerecord_unittest2 )
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Rebuild the MySQL test databases'
|
29
|
+
task :rebuild_mysql_databases => [:drop_mysql_databases, :build_mysql_databases]
|
30
|
+
|
31
|
+
desc 'Build the PostgreSQL test databases; Usage: DB_USER=<dbuser_or_postgres_default> rake build_postgresql_databases'
|
32
|
+
task :build_postgresql_databases do
|
33
|
+
%x( createdb -U #{db_user = DB_USER || 'postgres'} activerecord_unittest )
|
34
|
+
%x( createdb -U #{db_user} activerecord_unittest2 )
|
35
|
+
%x( psql activerecord_unittest -f #{File.join(SCHEMA_PATH, 'postgresql.sql')} #{db_user} )
|
36
|
+
%x( psql activerecord_unittest2 -f #{File.join(SCHEMA_PATH, 'postgresql2.sql')} #{db_user} )
|
37
|
+
end
|
38
|
+
|
39
|
+
desc 'Drop the PostgreSQL test databases'
|
40
|
+
task :drop_postgresql_databases do
|
41
|
+
%x( dropdb -U #{db_user = DB_USER || 'postgres'} activerecord_unittest )
|
42
|
+
%x( dropdb -U #{db_user} activerecord_unittest2 )
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Rebuild the PostgreSQL test databases'
|
46
|
+
task :rebuild_postgresql_databases => [:drop_postgresql_databases, :build_postgresql_databases]
|
47
|
+
|
48
|
+
desc 'Build the FrontBase test databases'
|
49
|
+
task :build_frontbase_databases => :rebuild_frontbase_databases
|
50
|
+
|
51
|
+
desc 'Rebuild the FrontBase test databases'
|
52
|
+
task :rebuild_frontbase_databases do
|
53
|
+
build_frontbase_database = Proc.new do |db_name, sql_definition_file|
|
54
|
+
%(
|
55
|
+
STOP DATABASE #{db_name};
|
56
|
+
DELETE DATABASE #{db_name};
|
57
|
+
CREATE DATABASE #{db_name};
|
58
|
+
|
59
|
+
CONNECT TO #{db_name} AS SESSION_NAME USER _SYSTEM;
|
60
|
+
SET COMMIT FALSE;
|
61
|
+
|
62
|
+
CREATE USER RAILS;
|
63
|
+
CREATE SCHEMA RAILS AUTHORIZATION RAILS;
|
64
|
+
COMMIT;
|
65
|
+
|
66
|
+
SET SESSION AUTHORIZATION RAILS;
|
67
|
+
SCRIPT '#{sql_definition_file}';
|
68
|
+
|
69
|
+
COMMIT;
|
70
|
+
|
71
|
+
DISCONNECT ALL;
|
72
|
+
)
|
73
|
+
end
|
74
|
+
create_activerecord_unittest = build_frontbase_database['activerecord_unittest', File.join(SCHEMA_PATH, 'frontbase.sql')]
|
75
|
+
create_activerecord_unittest2 = build_frontbase_database['activerecord_unittest2', File.join(SCHEMA_PATH, 'frontbase2.sql')]
|
76
|
+
execute_frontbase_sql = Proc.new do |sql|
|
77
|
+
system(<<-SHELL)
|
78
|
+
/Library/FrontBase/bin/sql92 <<-SQL
|
79
|
+
#{sql}
|
80
|
+
SQL
|
81
|
+
SHELL
|
82
|
+
end
|
83
|
+
execute_frontbase_sql[create_activerecord_unittest]
|
84
|
+
execute_frontbase_sql[create_activerecord_unittest2]
|
85
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
print "Using native DB2\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'db2',
|
10
|
+
:host => 'localhost',
|
11
|
+
:username => 'arunit',
|
12
|
+
:password => 'arunit',
|
13
|
+
:database => 'arunit'
|
14
|
+
},
|
15
|
+
'arunit2' => {
|
16
|
+
:adapter => 'db2',
|
17
|
+
:host => 'localhost',
|
18
|
+
:username => 'arunit',
|
19
|
+
:password => 'arunit',
|
20
|
+
:database => 'arunit2'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
25
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
print "Using native Firebird\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'firebird',
|
10
|
+
:host => 'localhost',
|
11
|
+
:username => 'rails',
|
12
|
+
:password => 'rails',
|
13
|
+
:database => 'activerecord_unittest',
|
14
|
+
:charset => 'UTF8'
|
15
|
+
},
|
16
|
+
'arunit2' => {
|
17
|
+
:adapter => 'firebird',
|
18
|
+
:host => 'localhost',
|
19
|
+
:username => 'rails',
|
20
|
+
:password => 'rails',
|
21
|
+
:database => 'activerecord_unittest2'
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
26
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
puts 'Using native Frontbase'
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'frontbase',
|
10
|
+
:host => 'localhost',
|
11
|
+
:username => 'rails',
|
12
|
+
:password => '',
|
13
|
+
:database => 'activerecord_unittest',
|
14
|
+
:session_name => "unittest-#{$$}"
|
15
|
+
},
|
16
|
+
'arunit2' => {
|
17
|
+
:adapter => 'frontbase',
|
18
|
+
:host => 'localhost',
|
19
|
+
:username => 'rails',
|
20
|
+
:password => '',
|
21
|
+
:database => 'activerecord_unittest2',
|
22
|
+
:session_name => "unittest-#{$$}"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
27
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
print "Using native MySQL\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
RAILS_DEFAULT_LOGGER = Logger.new('debug.log')
|
6
|
+
RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
|
7
|
+
ActiveRecord::Base.logger = RAILS_DEFAULT_LOGGER
|
8
|
+
|
9
|
+
# GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost';
|
10
|
+
# GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost';
|
11
|
+
|
12
|
+
ActiveRecord::Base.configurations = {
|
13
|
+
'arunit' => {
|
14
|
+
:adapter => 'mysql',
|
15
|
+
:username => 'rails',
|
16
|
+
:encoding => 'utf8',
|
17
|
+
:database => 'activerecord_unittest',
|
18
|
+
},
|
19
|
+
'arunit2' => {
|
20
|
+
:adapter => 'mysql',
|
21
|
+
:username => 'rails',
|
22
|
+
:database => 'activerecord_unittest2'
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
27
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
print "Using native OpenBase\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'openbase',
|
10
|
+
:username => 'admin',
|
11
|
+
:database => 'activerecord_unittest',
|
12
|
+
},
|
13
|
+
'arunit2' => {
|
14
|
+
:adapter => 'openbase',
|
15
|
+
:username => 'admin',
|
16
|
+
:database => 'activerecord_unittest2'
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
21
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
print "Using Oracle\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new STDOUT
|
6
|
+
ActiveRecord::Base.logger.level = Logger::WARN
|
7
|
+
|
8
|
+
# Set these to your database connection strings
|
9
|
+
db = ENV['ARUNIT_DB'] || 'activerecord_unittest'
|
10
|
+
|
11
|
+
ActiveRecord::Base.configurations = {
|
12
|
+
'arunit' => {
|
13
|
+
:adapter => 'oracle',
|
14
|
+
:username => 'arunit',
|
15
|
+
:password => 'arunit',
|
16
|
+
:database => db,
|
17
|
+
},
|
18
|
+
'arunit2' => {
|
19
|
+
:adapter => 'oracle',
|
20
|
+
:username => 'arunit2',
|
21
|
+
:password => 'arunit2',
|
22
|
+
:database => db
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
27
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
print "Using native PostgreSQL\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'postgresql',
|
10
|
+
:username => 'postgres',
|
11
|
+
:database => 'activerecord_unittest',
|
12
|
+
:min_messages => 'warning'
|
13
|
+
},
|
14
|
+
'arunit2' => {
|
15
|
+
:adapter => 'postgresql',
|
16
|
+
:username => 'postgres',
|
17
|
+
:database => 'activerecord_unittest2',
|
18
|
+
:min_messages => 'warning'
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
23
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
print "Using native SQlite\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
+
|
6
|
+
class SqliteError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
|
10
|
+
sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite"
|
11
|
+
sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite"
|
12
|
+
|
13
|
+
def make_connection(clazz, db_file)
|
14
|
+
ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite', :database => db_file } }
|
15
|
+
unless File.exist?(db_file)
|
16
|
+
puts "SQLite database not found at #{db_file}. Rebuilding it."
|
17
|
+
sqlite_command = %Q{sqlite #{db_file} "create table a (a integer); drop table a;"}
|
18
|
+
puts "Executing '#{sqlite_command}'"
|
19
|
+
raise SqliteError.new("Seems that there is no sqlite executable available") unless system(sqlite_command)
|
20
|
+
end
|
21
|
+
clazz.establish_connection(clazz.name)
|
22
|
+
end
|
23
|
+
|
24
|
+
make_connection(ActiveRecord::Base, sqlite_test_db)
|
25
|
+
make_connection(Course, sqlite_test_db2)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
print "Using native SQLite3\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
+
|
6
|
+
class SqliteError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
|
10
|
+
sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite3"
|
11
|
+
sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite3"
|
12
|
+
|
13
|
+
def make_connection(clazz, db_file)
|
14
|
+
ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite3', :database => db_file, :timeout => 5000 } }
|
15
|
+
unless File.exist?(db_file)
|
16
|
+
puts "SQLite3 database not found at #{db_file}. Rebuilding it."
|
17
|
+
sqlite_command = %Q{sqlite3 #{db_file} "create table a (a integer); drop table a;"}
|
18
|
+
puts "Executing '#{sqlite_command}'"
|
19
|
+
raise SqliteError.new("Seems that there is no sqlite3 executable available") unless system(sqlite_command)
|
20
|
+
end
|
21
|
+
clazz.establish_connection(clazz.name)
|
22
|
+
end
|
23
|
+
|
24
|
+
make_connection(ActiveRecord::Base, sqlite_test_db)
|
25
|
+
make_connection(Course, sqlite_test_db2)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
print "Using native SQLite3\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
+
|
6
|
+
class SqliteError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
def make_connection(clazz, db_definitions_file)
|
10
|
+
clazz.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
11
|
+
File.read("#{File.dirname(__FILE__)}/../../fixtures/db_definitions/#{db_definitions_file}").split(';').each do |command|
|
12
|
+
clazz.connection.execute(command) unless command.strip.empty?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
make_connection(ActiveRecord::Base, 'sqlite.sql')
|
17
|
+
make_connection(Course, 'sqlite2.sql')
|
18
|
+
load("#{File.dirname(__FILE__)}/../../fixtures/db_definitions/schema.rb"))
|
@@ -0,0 +1,23 @@
|
|
1
|
+
print "Using native SQLServer\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'sqlserver',
|
10
|
+
:host => 'localhost',
|
11
|
+
:username => 'sa',
|
12
|
+
:database => 'activerecord_unittest'
|
13
|
+
},
|
14
|
+
'arunit2' => {
|
15
|
+
:adapter => 'sqlserver',
|
16
|
+
:host => 'localhost',
|
17
|
+
:username => 'sa',
|
18
|
+
:database => 'activerecord_unittest2'
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
23
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
print "Using native SQLServer via ODBC\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'sqlserver',
|
10
|
+
:mode => 'ODBC',
|
11
|
+
:host => 'localhost',
|
12
|
+
:username => 'sa',
|
13
|
+
:dsn => 'activerecord_unittest'
|
14
|
+
},
|
15
|
+
'arunit2' => {
|
16
|
+
:adapter => 'sqlserver',
|
17
|
+
:mode => 'ODBC',
|
18
|
+
:host => 'localhost',
|
19
|
+
:username => 'sa',
|
20
|
+
:dsn => 'activerecord_unittest2'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
25
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
print "Using native Sybase Open Client\n"
|
2
|
+
require_dependency 'fixtures/course'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = {
|
8
|
+
'arunit' => {
|
9
|
+
:adapter => 'sybase',
|
10
|
+
:host => 'database_ASE',
|
11
|
+
:username => 'sa',
|
12
|
+
:database => 'activerecord_unittest'
|
13
|
+
},
|
14
|
+
'arunit2' => {
|
15
|
+
:adapter => 'sybase',
|
16
|
+
:host => 'database_ASE',
|
17
|
+
:username => 'sa',
|
18
|
+
:database => 'activerecord_unittest2'
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
23
|
+
Course.establish_connection 'arunit2'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
DROP TABLE accounts;
|
2
|
+
DROP TABLE funny_jokes;
|
3
|
+
DROP TABLE companies;
|
4
|
+
DROP TABLE topics;
|
5
|
+
DROP TABLE developers;
|
6
|
+
DROP TABLE projects;
|
7
|
+
DROP TABLE developers_projects;
|
8
|
+
DROP TABLE orders;
|
9
|
+
DROP TABLE customers;
|
10
|
+
DROP TABLE movies;
|
11
|
+
DROP TABLE subscribers;
|
12
|
+
DROP TABLE booleantests;
|
13
|
+
DROP TABLE auto_id_tests;
|
14
|
+
DROP TABLE entrants;
|
15
|
+
DROP TABLE colnametests;
|
16
|
+
DROP TABLE mixins;
|
17
|
+
DROP TABLE people;
|
18
|
+
DROP TABLE readers;
|
19
|
+
DROP TABLE binaries;
|
20
|
+
DROP TABLE computers;
|
21
|
+
DROP TABLE posts;
|
22
|
+
DROP TABLE comments;
|
23
|
+
DROP TABLE authors;
|
24
|
+
DROP TABLE tasks;
|
25
|
+
DROP TABLE categories;
|
26
|
+
DROP TABLE categories_posts;
|
27
|
+
DROP TABLE fk_test_has_pk;
|
28
|
+
DROP TABLE fk_test_has_fk;
|
29
|
+
DROP TABLE keyboards;
|
30
|
+
DROP TABLE legacy_things;
|
31
|
+
DROP TABLE numeric_data;
|
32
|
+
DROP TABLE mixed_case_monkeys;
|