aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2012-10-23 14:17:29 -0700
committerAdam Soltys <[email protected]>2012-10-23 14:20:07 -0700
commit94e17c0d9fb972cfa0bac3267a1761520eee6fd5 (patch)
tree22a209e242319ffdf6541d3f66bcac22d2629155
parent17700663db6c1a53cad013526429fb3d9ea2d6f9 (diff)
downloadcoinos-server-94e17c0d9fb972cfa0bac3267a1761520eee6fd5.tar.gz
coinos-server-94e17c0d9fb972cfa0bac3267a1761520eee6fd5.zip
Create database using activerecord migration
-rw-r--r--.gitignore2
-rw-r--r--Gemfile2
-rw-r--r--db/migrate.rb.sample14
-rw-r--r--db/migrations/001_create_users.rb10
4 files changed, 28 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index b861dc10..a6f7ae91 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
ticker.json
transactions.csv
.htpasswd
+.rvmrc
+db/migrate.rb
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 00000000..bc9d3812
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'activerecord'
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