summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorAndrey Kumanyaev <me@zzet.org>2012-10-10 03:31:51 +0400
committerAndrey Kumanyaev <me@zzet.org>2012-10-10 03:58:34 +0400
commit4eb7d82ae7b085049a889b8f4e7d421f05b39d07 (patch)
tree6addc144188fe8393442a48ded3c4902cc3b474f /db
parent3e1d52f4b7accb100d8a312236f8fc8005b78a69 (diff)
downloadgitlab-ce-4eb7d82ae7b085049a889b8f4e7d421f05b39d07.tar.gz
add support use string FK with integer PK
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20121009205010_postgres_create_integer_cast.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20121009205010_postgres_create_integer_cast.rb b/db/migrate/20121009205010_postgres_create_integer_cast.rb
new file mode 100644
index 00000000000..b9a971387d1
--- /dev/null
+++ b/db/migrate/20121009205010_postgres_create_integer_cast.rb
@@ -0,0 +1,15 @@
+class PostgresCreateIntegerCast < ActiveRecord::Migration
+ def up
+ execute <<-SQL
+ CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
+ SQL
+ rescue ActiveRecord::StatementInvalid
+ end
+
+ def down
+ execute <<-SQL
+ DROP CAST (integer AS text);
+ SQL
+ rescue ActiveRecord::StatementInvalid
+ end
+end