jorahood-ar-extensions 0.9.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/ChangeLog +145 -0
  2. data/README +167 -0
  3. data/Rakefile +79 -0
  4. data/config/database.yml +7 -0
  5. data/config/database.yml.template +7 -0
  6. data/config/mysql.schema +72 -0
  7. data/config/postgresql.schema +39 -0
  8. data/db/migrate/generic_schema.rb +96 -0
  9. data/db/migrate/mysql_schema.rb +31 -0
  10. data/db/migrate/oracle_schema.rb +5 -0
  11. data/db/migrate/version.rb +4 -0
  12. data/init.rb +31 -0
  13. data/lib/ar-extensions/create_and_update.rb +509 -0
  14. data/lib/ar-extensions/csv.rb +309 -0
  15. data/lib/ar-extensions/delete.rb +143 -0
  16. data/lib/ar-extensions/extensions.rb +506 -0
  17. data/lib/ar-extensions/finder_options.rb +275 -0
  18. data/lib/ar-extensions/finders.rb +94 -0
  19. data/lib/ar-extensions/foreign_keys.rb +70 -0
  20. data/lib/ar-extensions/fulltext.rb +62 -0
  21. data/lib/ar-extensions/import.rb +352 -0
  22. data/lib/ar-extensions/insert_select.rb +178 -0
  23. data/lib/ar-extensions/synchronize.rb +30 -0
  24. data/lib/ar-extensions/temporary_table.rb +124 -0
  25. data/lib/ar-extensions/union.rb +204 -0
  26. data/lib/ar-extensions/version.rb +9 -0
  27. data/tests/connections/native_mysql/connection.rb +16 -0
  28. data/tests/connections/native_oracle/connection.rb +16 -0
  29. data/tests/connections/native_postgresql/connection.rb +19 -0
  30. data/tests/connections/native_sqlite/connection.rb +14 -0
  31. data/tests/connections/native_sqlite3/connection.rb +14 -0
  32. data/tests/fixtures/addresses.yml +25 -0
  33. data/tests/fixtures/books.yml +46 -0
  34. data/tests/fixtures/developers.yml +20 -0
  35. data/tests/fixtures/unit/active_record_base_finders/addresses.yml +25 -0
  36. data/tests/fixtures/unit/active_record_base_finders/books.yml +64 -0
  37. data/tests/fixtures/unit/active_record_base_finders/developers.yml +20 -0
  38. data/tests/fixtures/unit/synchronize/books.yml +16 -0
  39. data/tests/fixtures/unit/to_csv_headers/addresses.yml +8 -0
  40. data/tests/fixtures/unit/to_csv_headers/developers.yml +6 -0
  41. data/tests/fixtures/unit/to_csv_with_common_options/addresses.yml +40 -0
  42. data/tests/fixtures/unit/to_csv_with_common_options/developers.yml +13 -0
  43. data/tests/fixtures/unit/to_csv_with_common_options/languages.yml +29 -0
  44. data/tests/fixtures/unit/to_csv_with_common_options/teams.yml +3 -0
  45. data/tests/fixtures/unit/to_csv_with_default_options/developers.yml +7 -0
  46. data/tests/models/address.rb +4 -0
  47. data/tests/models/animal.rb +2 -0
  48. data/tests/models/book.rb +3 -0
  49. data/tests/models/cart_item.rb +4 -0
  50. data/tests/models/developer.rb +8 -0
  51. data/tests/models/group.rb +3 -0
  52. data/tests/models/language.rb +5 -0
  53. data/tests/models/mysql/book.rb +3 -0
  54. data/tests/models/mysql/test_innodb.rb +3 -0
  55. data/tests/models/mysql/test_memory.rb +3 -0
  56. data/tests/models/mysql/test_myisam.rb +3 -0
  57. data/tests/models/project.rb +2 -0
  58. data/tests/models/shopping_cart.rb +4 -0
  59. data/tests/models/team.rb +4 -0
  60. data/tests/models/topic.rb +13 -0
  61. data/tests/mysql/test_create_and_update.rb +290 -0
  62. data/tests/mysql/test_delete.rb +142 -0
  63. data/tests/mysql/test_finder_options.rb +121 -0
  64. data/tests/mysql/test_finders.rb +29 -0
  65. data/tests/mysql/test_import.rb +354 -0
  66. data/tests/mysql/test_insert_select.rb +173 -0
  67. data/tests/mysql/test_mysql_adapter.rb +45 -0
  68. data/tests/mysql/test_union.rb +81 -0
  69. data/tests/oracle/test_adapter.rb +14 -0
  70. data/tests/postgresql/test_adapter.rb +14 -0
  71. metadata +147 -0
data/ChangeLog ADDED
@@ -0,0 +1,145 @@
1
+ 2009-07-22 zdennis <zach.dennis@gmail.com>
2
+
3
+ * Forgot to push past commit of fixing #sanitize_sql method signatures to supported passing in a table_name. This satisfies the change to the ActiveRecord API in Rails commit 489abfd3b23f3c4b3de86aeb3bde3970771c001b on April 20th.
4
+
5
+ 2009-04-17 blythedunham <blythedunham@gmail.com>
6
+
7
+ * Added MySQL support for save, create, replace options - :ignore, :on_duplicate_key_update, :keywords, :reload, :keywords, :pre_sql, :post_sql
8
+ * Added MySQL support for find options: :keywords, :pre_sql, :post_sql, :index_hint
9
+ * Added MySQL support for find_union and count_union
10
+ * Added MySQL support for insert_select
11
+ * Added MySQL support for delete_duplicates and delete_all :batch_size => X
12
+ * Updated :on_duplicate_update_key to accept a string in addition to array
13
+ * Fixed Find Extension Range bug to exclude end when ... used instead of ..
14
+
15
+ 2009-03-16 zdennis <zach.dennis@gmail.com>
16
+
17
+ * fixed Rails 2.3.1 and 2.3.2 compatibility issue (Stephen Heuer)
18
+
19
+ 2009-02-09 zdennis <zach.dennis@gmail.com>
20
+
21
+ * fixed issue in http://zdennis.lighthouseapp.com/projects/14379/tickets/14-join-table-conditions-broken
22
+ * Updated usage of Inflector to point to ActiveSupport::Inflector
23
+ * Fixed bug where finder conditions which use arext-suffixed keys and normal field keys would fail when using a conditions hash. (Gabe da Silveira)
24
+ * added timestamps options to not automatically add timestamps even if record timestamps is disabled in ActiveRecord::Base (Thibaud Guillaume-Gentil)
25
+ * Updated to use alias_method_chain so that multiple aliased finders remain intact (Marcus Crafter)
26
+
27
+ 2007-07-20 zdennis <zdennis@dhcp-22.atomicobject.localnet>
28
+
29
+ * Added patch from Michael Flester to fix bug with created_at/updated_at fields to use proper timezone.
30
+
31
+ 2007-07-18 zdennis <zdennis@dhcp-22.atomicobject.localnet>
32
+
33
+ * Added patch for Oracle support from Michael Flester.
34
+
35
+ 2007-05-05 zdennis <zdennis@elijah.local>
36
+
37
+ * Added ActiveRecord::Base::AbstractAdapter#synchronize method which allows a mass re-synchronization of ActiveRecord instances. This is similar to ActiveRecord::Base#reload except that it works on multiple instances at a time rather then one. This sends one query for all instances rather then 1 per instance reloaded.
38
+
39
+ * Fixed bug with URI encoded strings with a workaround in the Comparison extension. ActiveRecord needs to be fixed to not use the String#% method so strings that do contains percentage signs will not fail
40
+
41
+ * Applied patch from Grant Goodale to allow the Like extension to support arrays when using the '_contains' suffix
42
+
43
+ 2007-03-14 zdennis <zdennis@elijah.xrite.com>
44
+
45
+ * Fixed a bug by renaming the alias for the ActiveRecord::Base#quote method in finders.rb. See rubyforge bug #8996
46
+
47
+ * Made a .gemspec for ar-extensions
48
+
49
+ 2007-03-13 zdennis <zdennis@elijah>
50
+
51
+ * Added :datetime searching support for better finder support.
52
+
53
+ 2007-02-11 zdennis <zdennis@admin.aries>
54
+
55
+ * Updated to_csv and import functionality to work with Sqlite, Sqlite3, PostgreSQL and MySQL
56
+
57
+ * Updated RDOC for import, to_csv, better finders, temporary tables and foreign key support
58
+
59
+ 2007-01-29 zdennis <zdennis@mktec.com>
60
+
61
+ * Added initial support for temporary tables and permanent like tables.
62
+
63
+ 2007-01-24 zdennis <zdennis@mktec.com>
64
+
65
+ * Added dependency for Mocha 0.4.0 or higher for testing
66
+
67
+ * Fixed bug for import functionality where it was never actually splitting up values correctly (thx to Mark Van Holstyn!!)
68
+
69
+ 2007-01-09 zdennis <zdennis@aries>
70
+
71
+ * Added support for embedded to_csv includes
72
+
73
+ 2007-01-07 zdennis <zdennis@aries>
74
+
75
+ * Added fix to init.rb to only load CSV functionality if FasterCSV
76
+ is available, otherwise print a message to STDERR and continue.
77
+
78
+ * Added fix to tests/boot.rb which solves fixture_path issues in
79
+ ActiveRecord 1.14.4 and earlier. The fix is included Rails trunk
80
+ and will be available in Rails 1.2.
81
+
82
+ 2007-01-05 zdennis <zdennis@aries>
83
+
84
+ * Added ActiveRecord::Extensions::VERSION module which has the following constants: MAJOR, MINOR, REVISION
85
+
86
+ * Running rake tests are now smart enough to rebuild the database if they are required based on schema_info table.
87
+
88
+ * Added schema_info table for test database schemas.
89
+
90
+ 2006-12-29 zdennis <zdennis@aries>
91
+
92
+ * Updated the Rakefile to run an external ruby process when running test files rather then in the same ruby process that runs the Rakefile
93
+
94
+ * Updated the directory structure of lib/ to solve namespace issues.
95
+
96
+ 2006-12-22 Zach Dennis <zdennis@silver.dennis.network>
97
+
98
+ * Added rake tasks for sqlite and sqlite3 databases
99
+
100
+ * Added "does_not_match" as a suffix to better finders when working with Regular Expressions
101
+
102
+ * Added "not_between" suffix to better finders when working with Ranges
103
+
104
+ 2006-12-17 zdennis <zdennis@aries>
105
+
106
+ * Added :only and :except options to to_csv method. Forcing
107
+ compatibility with http://blog.integralimpressions.com/articles/2006/09/01/tocsv-plugin
108
+
109
+ * Changed to_csv option :headers take a boolean rather then an
110
+ array of column names.
111
+
112
+ * Added rake task db:prepare_<adapter_name> to build test
113
+ database.
114
+
115
+ 2006-12-16 Zach Dennis <zdennis@silver.dennis.network>
116
+
117
+ * Added more tests for better finder support
118
+
119
+ * Added to_csv support for Arrays returned by ActiveRecord::Base.find
120
+
121
+ * Refactored ActiveRecord::Extensions::Registry to use an Array instead of hash
122
+
123
+ 2006-12-06 Zach Dennis <zdennis@silver.dennis.network>
124
+
125
+ * PostgreSQL has tested support for everything MySQL has except for Full Text Searching. This is not implemented.
126
+
127
+ * Refactored how import and full text searching implementation is handled, this is largely handled by duck typing certain method calls.
128
+
129
+ * Added generic import support for any adapter that doesn't support multi-value insert statements. This provides generic support which is guaranteed to be no slower then ActiveRecord#create.
130
+
131
+ 2006-11-23 Zach Dennis <zdennis@silver.dennis.network>
132
+
133
+ * Added finder support for PostgreSQL including Regexp Searching. (No full text searching though)
134
+
135
+ * Fixed bug in finders.rb where NULL searches were not correctly being translated into IS NULL when doing { :column => nil }
136
+
137
+ 2006-11-20 Zach Dennis <zach.dennis@gmail.com>
138
+
139
+ * Refactored core finder components out into ActiveRecord extensions
140
+
141
+ * Duck typing support for any object that is passed in to a conditions hash. ie: MyModel.find( :all, :conditions=>{ :name=>NameSearchObject.new } )
142
+
143
+ * Duck typing support for any object that is passed in as a condition. ie: MyModel.find( :all, :conditions=>SearchObject.new )
144
+
145
+
data/README ADDED
@@ -0,0 +1,167 @@
1
+ LICENSE
2
+ ----------
3
+ This is licensed under the ruby license.
4
+
5
+ Author: Zach Dennis
6
+ Web Site: http://www.continuousthinking.com/tags/arext
7
+ Email: zach.dennis@gmail.com
8
+
9
+ - For How-To information see http://www.continuousthinking.com/tags/arext
10
+ - For project information and feedback please consult http://rubyforge.org/projects/arext/
11
+ - For release information please see below
12
+
13
+ ActiveRecord::Extensions 0.9.0, 0.9.1
14
+ ------------------------------
15
+ April 17, 2009
16
+ - Added MySQL support for save, create, replace options - :ignore, :on_duplicate_key_update, :keywords, :reload, :keywords, :pre_sql, :post_sql
17
+ - Added MySQL support for find options: :keywords, :pre_sql, :post_sql, :index_hint
18
+ - Added MySQL support for find_union and count_union
19
+ - Added MySQL support for insert_select
20
+ - Added MySQL support for delete_duplicates and delete_all :batch_size => X
21
+ - Updated :on_duplicate_update_key to accept a string in addition to array
22
+ - Fixed Find Extension Range bug to exclude end when ... used instead of ..
23
+
24
+ ActiveRecord::Extensions 0.8.2
25
+ ------------------------------
26
+ March 16th, 2009
27
+ - Rails 2.3.1 and 2.3.2 compatibility added
28
+ - Rails 2.1.2 and 2.2.2 compatibility preserved
29
+
30
+ AciveRecord::Extensions 0.7.0
31
+ -----------------------------
32
+ July 20th, 2007
33
+ - Fixes timezone issue (thanks Michael Flester)
34
+ - Adds better finder and import support for Oracle (thanks Michael Flester)
35
+ - Committed patch to fix MySQL query padding, thanks to Gabe da Silveira
36
+ - Added functionality for MySQL to work with created_on, created_at, updated_on or updated_at fields
37
+ - Added more test coverage for import functionality
38
+
39
+ ActiveRecord::Extensions 0.6.0
40
+ ------------------------------
41
+ May 5th, 2007
42
+ - Fixed bug with URI escaped strings and the Comparison better finder extension
43
+ - Added support for arrays with the Like better finder extension when using the '_contains' suffix
44
+ - Added 'synchronize' support for ActiveRecord::Base instances when using Import functionality
45
+
46
+ ActiveRecord::Extensions 0.5.2
47
+ ------------------------------
48
+ March 14th, 2007
49
+ - Fixed Rubyforge bug #8996 by renaming alias in finders.rb to the ActiveRecord::Base#quote method
50
+
51
+ ActiveRecord::Extensions 0.5.1
52
+ ------------------------------
53
+ March 14th, 2007
54
+ - Released as a rubygem
55
+ - Added a .gemspec file
56
+
57
+ ActiveRecord::Extensions 0.5.0
58
+ ------------------------------
59
+ March 13th, 2007
60
+ - Added Time based query support which works on ActiveRecord columns which match a type supported by :datetime
61
+
62
+ ActiveRecord::Extensions 0.4.0
63
+ ------------------------------
64
+ February 11th, 2007
65
+ - Added to_csv functionality
66
+ - Added temporary table support (MySQL)
67
+ - Added foreign key support (MySQL)
68
+ - Updated tests to keep schema information. Test database will automatically rebuild themselves if they are out of sync
69
+ - Added dependency for Mocha 0.4.0 or higher for tests
70
+
71
+ ActiveRecord::Extensions 0.3.0
72
+ ------------------------------
73
+ December 29th, 2006
74
+ - Updates to the lib/ directory structure to avoid namespace issues.
75
+ - Updates to the Rakefile to run an external ruby process for tests rather then the same
76
+ ruby process that runs the rake tasks
77
+
78
+ ActiveRecord::Extensions 0.2.0
79
+ ------------------------------
80
+ December 22nd, 2006
81
+ - Updates to_csv method for arrays returned by ActiveRecord::Base.find
82
+ - Adds does_not_match suffix for regular expression based conditions, ie: :field_does_not_match => /regex/
83
+ - Adds not_between suffix for ange based conditions, ie: :id_not_between => ( 0 .. 1 )
84
+ - Adds SQLite and SQLite3 support for better finders.
85
+ - Updates rake tasks for sqlite and sqlite3.
86
+ - Added rake tasks to use database migrations rather then raw SQL schema files.
87
+
88
+ ActiveRecord::Extensions 0.1.0
89
+ -------------------------------
90
+ December 16th, 2006
91
+ - Adds to_csv method to arrays returned by ActiveRecord::Base.find.
92
+ - Fixes bug in ActiveRecord::Extensions::Registry when processing key/value pairs where
93
+ the order of certain Extensions was not handled correctly due to Hash usage.
94
+ - Refactoring of ActiveRecord::Extensions::Registry
95
+ - Added more tests for better finder support
96
+
97
+ ActiveRecord::Extensions 0.0.6
98
+ ------------------------------
99
+ December 5th, 2006
100
+ - Added generic support for import functionality for all adapters
101
+ - Includes rake testing tasks for postgresql
102
+ - Includes postgresql support for all extensions except for full text searching (which is only mysql)
103
+ - Refactored directory structure of tests, import functionality and fulltext functionality
104
+
105
+
106
+ ActiveRecord::Extensions 0.0.5
107
+ ------------------------------
108
+ October 20th, 2006.
109
+ - Fixes two bugs which broke normal ActiveRecord behavior
110
+ - Fully complaint with Rails 1.1.0 thru 1.1.6 (and all ActiveRecord versions released with those)
111
+ - Inlcudes new Rakefile
112
+ - Includes rake task "test:mysql" which allows ActiveRecord::Extensions to be tested with mysql
113
+ - Includes rake test "test:activerecord:mysql" which allows ActiveRecord's tests to be tested with the
114
+ ActiveRecord::Extensions library
115
+
116
+
117
+ ActiveRecord::Extensions 0.0.4
118
+ -------------------------------
119
+ August 26th, 2006. Released at RubyConf*MI.
120
+ September 24th, 2006, Rubyforge release.
121
+ - Inlcudes "Better Finder" support for ActiveRecord
122
+ http://blogs.mktec.com/zdennis/pages/ARE_finders
123
+
124
+
125
+ ActiveRecord::Extensions 0.0.3
126
+ -------------------------------
127
+ Released.... ????
128
+ - the project has been named ActiveRecord::Extensions.
129
+
130
+
131
+ ActiveRecord::Optimizations 0.0.2
132
+ ---------------------------------
133
+ July 20th, 11:27pm, Zach Dennis
134
+
135
+ This includes some of the optimizations for the ActiveRecord::Base. This release only supports the MysqlAdapter, although other adapters will be supported in upcoming releases.
136
+
137
+ HOW-TO USAGE
138
+ ------------
139
+ Require the two files in the lib/ directory and then create records using:
140
+ Model.create array_of_hashes
141
+
142
+ Example:
143
+ class LogEntry < ActiveRecord::Base ; end
144
+ LogEntry.import [ { :log_entry_name=>"Name" }, {:log_entry_name=>"Name2"}, ... ], :optimize=>true
145
+
146
+ Using the optimized create method will return the number of inserts performed, rather then an array of LogEntry objects. This currently skips model validation.
147
+
148
+
149
+ CHANGELOG
150
+ ----------
151
+ 0.0.2
152
+ - add some documentation to the updated methods for ActiveRecord and MysqlAdapter
153
+ - renamed the create optimizatin to import. Multi-value inserts can be obtained using ActiveRecord::Base.import
154
+ 0.0.1
155
+ - introduced updates to ActiveRecord::Base.create to support multi-value inserts
156
+
157
+
158
+ UPCOMING
159
+ ----------
160
+ - model validation on imports
161
+ - postgresql support for imports
162
+ - ability to use regular expressions for db searches
163
+ - ability to use db functions
164
+ - temporary table support
165
+ - memory table support
166
+ - complex update with on duplicate key update support
167
+
data/Rakefile ADDED
@@ -0,0 +1,79 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ DIR = File.dirname( __FILE__ )
6
+
7
+ task :default => [ "test:mysql" ]
8
+
9
+ task :boot do
10
+ require File.expand_path( File.join( DIR, 'lib', 'ar-extensions' ) )
11
+ require File.expand_path( File.join( DIR, 'tests', 'connections', "native_#{ENV['ARE_DB']}", 'connection' ) )
12
+ require File.expand_path( File.join( DIR, 'db/migrate/version' ) )
13
+ end
14
+
15
+ ADAPTERS = %w( mysql postgresql sqlite sqlite3 oracle )
16
+
17
+ namespace :db do
18
+
19
+ namespace :test do
20
+ ADAPTERS.each do |adapter|
21
+ desc "builds test database for #{adapter}"
22
+ task "prepare_#{adapter}" do |t|
23
+ file2run = File.join( DIR, 'tests/prepare.rb' )
24
+ system( "ruby #{file2run} #{adapter}" )
25
+ end
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ namespace :test do
32
+
33
+ ADAPTERS.each do |adapter|
34
+ desc "test base extensions for #{adapter}"
35
+ task adapter do |t|
36
+ ENV['ARE_DB'] = adapter
37
+
38
+ task = Rake::Task[ "db:test:prepare_#{adapter}" ]
39
+ begin
40
+ task = false if SchemaInfo::VERSION == SchemaInfo.find( :first ).version
41
+ rescue Exception => ex
42
+ end
43
+ task.invoke if task
44
+
45
+ system "ruby #{File.join( DIR, 'tests/run.rb ' )} #{adapter}"
46
+ end
47
+ end
48
+
49
+ namespace :activerecord do
50
+
51
+ ADAPTERS.each do |adapter|
52
+ desc "runs ActiveRecord unit tests for #{adapter} with ActiveRecord::Extensions"
53
+ task adapter.to_sym do |t|
54
+ activerecord_dir = ARGV[1]
55
+ if activerecord_dir.nil? or ! File.directory?( activerecord_dir )
56
+ STDERR.puts "ERROR: Pass in the path to ActiveRecord. Eg: /home/zdennis/rails_trunk/activerecord"
57
+ exit
58
+ end
59
+
60
+ old_dir, old_env = Dir.pwd, ENV['RUBYOPT']
61
+ Dir.chdir( activerecord_dir )
62
+ ENV['RUBYOPT'] = "-r#{File.join(old_dir,'init.rb')}"
63
+
64
+ load "Rakefile"
65
+ Rake::Task[ "test_#{adapter}" ].invoke
66
+ Dir.chdir( old_dir )
67
+ ENV['RUBYOPT'] = old_env
68
+ end
69
+
70
+ desc "runs ActiveRecord unit tests for #{adapter} with ActiveRecord::Extensions with ALL available #{adapter} functionality"
71
+ task "#{adapter}_all" do |t|
72
+ ENV['LOAD_ADAPTER_EXTENSIONS'] = adapter.to_s
73
+ Rake::Task["test:activerecord:#{adapter}"].invoke
74
+ end
75
+ end
76
+
77
+ end
78
+
79
+ end
@@ -0,0 +1,7 @@
1
+ development:
2
+ adapter: mysql
3
+ database: aroptests
4
+ username: rails
5
+ password:
6
+ port: 3306
7
+ host: localhost
@@ -0,0 +1,7 @@
1
+ development:
2
+ adapter: mysql
3
+ database: aroptests
4
+ username: rails
5
+ password:
6
+ port: 3306
7
+ host: localhost
@@ -0,0 +1,72 @@
1
+
2
+ create table test_myisam(
3
+ id int(11) unsigned not null auto_increment,
4
+ my_name varchar(20) not null,
5
+ description varchar(255) default '',
6
+ primary key (id)
7
+ )ENGINE=MyISAM;
8
+
9
+
10
+ create table test_innodb(
11
+ id int(11) unsigned not null auto_increment,
12
+ my_name varchar(20) not null,
13
+ description varchar(255) default '',
14
+ primary key (id)
15
+ )ENGINE=InnoDb;
16
+
17
+
18
+ create table test_memory(
19
+ id int(11) unsigned not null auto_increment,
20
+ my_name varchar(20) not null,
21
+ description varchar(255) default '',
22
+ primary key (id)
23
+ )ENGINE=memory;
24
+
25
+
26
+ create temporary table test_temp(
27
+ id int(11) unsigned not null auto_increment,
28
+ my_name varchar(20) not null,
29
+ description varchar(255) default '',
30
+ primary key (id)
31
+ );
32
+
33
+ CREATE TABLE `topics` (
34
+ `id` int(11) NOT NULL auto_increment,
35
+ `title` varchar(255) default NULL,
36
+ `author_name` varchar(255) default NULL,
37
+ `author_email_address` varchar(255) default NULL,
38
+ `written_on` datetime default NULL,
39
+ `bonus_time` time default NULL,
40
+ `last_read` date default NULL,
41
+ `content` text,
42
+ `approved` tinyint(1) default '1',
43
+ `replies_count` int(11) default '0',
44
+ `parent_id` int(11) default NULL,
45
+ `type` varchar(50) default NULL,
46
+ PRIMARY KEY (`id`)
47
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
48
+
49
+ CREATE TABLE `projects` (
50
+ `id` int(11) NOT NULL auto_increment,
51
+ `name` varchar(100) default NULL,
52
+ `type` varchar(255) NOT NULL,
53
+ PRIMARY KEY (`id`)
54
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
55
+
56
+ CREATE TABLE `developers` (
57
+ `id` int(11) NOT NULL auto_increment,
58
+ `name` varchar(100) default NULL,
59
+ `salary` int(11) default '70000',
60
+ `created_at` datetime default NULL,
61
+ `updated_at` datetime default NULL,
62
+ PRIMARY KEY (`id`)
63
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
64
+
65
+ CREATE TABLE `books` (
66
+ `id` int(11) NOT NULL auto_increment,
67
+ `title` varchar(255) NOT NULL,
68
+ `publisher` varchar(255) NOT NULL,
69
+ `author_name` varchar(255) NOT NULL,
70
+ PRIMARY KEY (`id`),
71
+ FULLTEXT( `title`, `publisher`, `author_name` )
72
+ ) ENGINE=MyISAM;