-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support more datatypes & better identity_insert #75
base: master
Are you sure you want to change the base?
Conversation
I modified $getColumnDefinition so it uses the wheels $dbinfo tag and also passes in the "pattern" argument so that it only returns a single column, instead of the whole table.
I moved most of the SQL building code from migration.cfc to /adapters/abstract.cfc This allows the adapter to add any special handling, which at this point is primarily to support SQL Server Identity Insert correctly
Added $getIdentityColumn which gives the name of the "identity" column on the table. This is necessary because an identity column doesn't have to be the primary key. Extending abstract's addRecord method, this now checks for trying to insert a value into any "identity" column, not just one named "id". Removed addRecordPrefix & addRecordSuffix
added new limit options for integers, dates, & money (maps to decimal on non-mssql db) handy new methods mediumInteger(), smallInteger(), tinyInteger() adds support for MSSQL: DATE, SMALLDATETIME, MONEY, SMALLMONEY, BIGINT, SMALLINT, TINYINT adds support for mysql: BIGINT UNSIGNED, BIGINT, INT UNSIGNED, MEDIUMINT UNSIGNED, MEDIUMINT, SMALLINT UNSIGNED, SMALLINT, TINYINT UNSIGNED, TINYINT
@jordanclark thanks for this substantial contribution. I'll make some time to merge the diff into a new topic branch to test. Would you have any migration files that you could share to help test this functionality? I'm trying to create a set of these to test each change that I implement as it's the only way I've found to do testing. If you could add them to the tests folder push back up here they should be added to this merge request |
You were correct the latest changes are part of the pull request, I'm a git-noob but at least I'm learning. Here are 3 test migrations, I hope that helps. |
Jordan, Please don't apologize, even though I've been using Git for two years I'm On Sun, Mar 31, 2013 at 10:46 PM, jordanclark [email protected]:
Troy Murray |
…mns (only currently supports MSSQL & MySQL) Add CHAR() column type for fixed length columns MSSQL: CHAR, NCHAR, NVARCHAR, NTEXT MYSQL: Character encoding for char, string & text Oracle: CHAR PostgreSQL: CHARACTER
(resolves andybellenie's issue tdm00#57)
… allow overriding. Added NULL support to addRecord/updateRecord. Added automatic timestamp support for createdAt/updatedAt and soft-delete deletedAt
…Instead the quoteTableName() method is the perfect place to force lower case for mysql, and let the other adapters decide what they want to do in their own quoteTableName(). Apparently postgress & oracle don't require quoting names, because if you do the name becomes case-sensitive, so now those adapters check if the name needs to be quoted instead of always doing it. Also fixes issue tdm00#43 for quoting postgres table names.
@jordanclark I haven't forgotten about this pull request. I tried merging it with a new topic branch last week and it broke the plugins ability to load the migrations. I'm working on trying to find out why as it must be working for you. |
@tdm00 Troy sorry about that bug, I also created a fix for railo 4 and createObjectFromRoot and incorrectly transfered the code into the plugin. It should be working correctly now. |
Jordan, I tried merging this after you sent it and the plugin stopped working. I On Friday, April 26, 2013, jordanclark wrote:
Troy Murray |
Ping? |
Jordan, The last time I tried the merge on the master branch it still wasn't On Thu, Jul 4, 2013 at 6:46 PM, jordanclark [email protected]:
Troy Murray |
I have been using my updated version of the plugin without a problem for Were you using it with Railo? Because there is an unrelated bug in the Maybe give it another shot? Jordan On Thu, Jul 4, 2013 at 3:51 PM, Troy Murray [email protected]:
|
Sure, I'll give it a try tonight. On Friday, July 5, 2013, jordanclark wrote:
Troy Murray |
- Support empty string defaults (it doesn't have to be null) - Support SQL function defaults like GETDATE()
Added new limit options for integers, dates, & money (maps to decimal on non-mssql db)
handy new methods mediumInteger(), smallInteger(), tinyInteger()
adds support for MSSQL: DATE, SMALLDATETIME, MONEY, SMALLMONEY, BIGINT, SMALLINT, TINYINT
adds support for mysql: BIGINT UNSIGNED, BIGINT, INT UNSIGNED, MEDIUMINT UNSIGNED, MEDIUMINT, SMALLINT UNSIGNED, SMALLINT, TINYINT UNSIGNED, TINYINT
Improve the IDENTITY_INSERT feature added for SQL Server.
I've moved building SQL INSERT into the abstract adapter, this way the custom adapters can extend the code if necessary instead of just a prefix/suffix method.
For the Microsoft SQL adapter I check if any column being inserted into is an IDENTITY column, and then wrap the IDENTITY_INSERT code when necessary, before it would only work if your identity column happened to be named "id".
I also improved the $getColumnDefinition function which wasn't using the "pattern" argument to only return a single column instead of the whole database.