Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue about primary keys #25

Open
kuraga opened this issue Jan 3, 2013 · 2 comments
Open

Issue about primary keys #25

kuraga opened this issue Jan 3, 2013 · 2 comments

Comments

@kuraga
Copy link

kuraga commented Jan 3, 2013

@DAddYE There is some issue about primary keys.

According to readme:

Option :as or :type if not provided is :string by default, you can use all ActiveRecord types:

But col :name, as: :primary_key doesn't work because of ActiveRecord::ConnectionAdapters::TableDefinition#primary_key has one argument only, but we send two.

Then if I fix this issue (by removing options argument) I get next error:

ActiveRecord::StatementInvalid: SQLite3::SQLException: table "caras" has more than one primary key: CREATE TABLE "caras" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 

What do you think?

@DAddYE
Copy link
Owner

DAddYE commented Jan 13, 2013

I'll investigate soon, thanks for reporting this!

@cosine
Copy link
Collaborator

cosine commented Nov 12, 2014

There is a solution to this with the release of version 0.4.3, where you would do this:

create_table :primary_key => :name
col :name, :type => :string  # or :integer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants