Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

I found out that there is no MODIFY in SQLite. So my question now becomes:

How do I deal with this situation? I want to continue to use migrations, but I also want to be able to test using SQLite.

Is it possible to specify an alternative set of migrations for testing purposes?

Last updated 2 years ago.
0

I've used something like this in the past, as ->after() isn't supported either in sqlite (what I remember)

if (App::environment() == 'testing') {
    // Testing specific code -- you know this will be SQLite
} else {
    // Anything else
}

This would mean you could 'hack' previous migrations, that outside of testing do the same as they do now. But set the varchar to 20 in sqlite.

And make the second migration (the actual change from 10 to 20 length) empty for SQLite, but work normally for anything else.

Hope this gets you a step further and if there's a better way. I'm sure someone will correct me.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

benharold benharold Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.