I'm migrating a SQL database in the following way:
class CitiesRelation < ActiveRecord::Migration[5.0]
def change
self.connection.execute %Q(
-- Create Table --
CREATE TABLE Cities (
Id INT NOT NULL AUTO_INCREMENT,
Code INT NOT NULL,
Name VARCHAR(255) NOT NULL,
State CHAR(2) NOT NULL,
PRIMARY KEY (Id)
);
-- Insert Data --
Insert into Cities (Code, Name, State) values ('1100015','City_1', 'A');
Insert into Cities (Code, Name, State) values ('1100023','City_2', 'B');
Insert into Cities (Code, Name, State) values ('1100031','City_3', 'C');
)
end
end
And after the migration shows this error message:
PG::SyntaxError: ERROR: syntax error at or near "AUTO_INCREMENT"
LINE 6: Id INT NOT NULL AUTO_INCREMENT,
^
What is the best approach to solve this problem? I'm wondering to do it via seed but I don't know how. Thank you.
create_table :cities)