diff options
| author | Adam Soltys <[email protected]> | 2012-10-23 14:17:29 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-10-23 14:20:07 -0700 |
| commit | 94e17c0d9fb972cfa0bac3267a1761520eee6fd5 (patch) | |
| tree | 22a209e242319ffdf6541d3f66bcac22d2629155 /db | |
| parent | 17700663db6c1a53cad013526429fb3d9ea2d6f9 (diff) | |
| download | coinos-server-94e17c0d9fb972cfa0bac3267a1761520eee6fd5.tar.gz coinos-server-94e17c0d9fb972cfa0bac3267a1761520eee6fd5.zip | |
Create database using activerecord migration
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate.rb.sample | 14 | ||||
| -rw-r--r-- | db/migrations/001_create_users.rb | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate.rb.sample b/db/migrate.rb.sample new file mode 100644 index 00000000..4e6a9f77 --- /dev/null +++ b/db/migrate.rb.sample @@ -0,0 +1,14 @@ +require 'rubygems' +require 'active_record' + +ActiveRecord::Base.establish_connection( + :adapter=>'mysql2', + :hostname => 'localhost', + :username => 'root', + :password => '', + :database => 'bitcoin_pos', + :reconnect => true +) + +ActiveRecord::Migration.verbose = true +ActiveRecord::Migrator.migrate "migrations/" diff --git a/db/migrations/001_create_users.rb b/db/migrations/001_create_users.rb new file mode 100644 index 00000000..4225589d --- /dev/null +++ b/db/migrations/001_create_users.rb @@ -0,0 +1,10 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :address + t.decimal :credit, :precision => 10, :scale => 2 + t.string :logo + end + end +end |
