• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Error on migration:rollback that should drop a column- Using Laravel Homestead & SQlite

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I'm getting an error on running "php artisan migrate:rollback" in Git Bash that should drop a column.

I've already ran:
1. composer require doctrine/dbal
2. composer update
3. I even tried "composer dump-autoload"

When I check on the database schema using: "sqlite3 database/database.sqlite" the table contains all the columns (including the one called "excerpt" which is the rogue one that should be dropped) but on running the rollback I get the error that the column isn't published. See below.

(Environment: laravel 5.3- Homestead, Gitbash, Sublime Text3, SQlite3)

The error is as follows:




My database schema is as follows:




The Migration that created the column is as follows:



How do you solve this so that you can seamlessly drop columns using migrate:rollback?
 
Mwaura Raymond
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I resorted to using a mysql database which runs flawlessly within the homestead virtual box. Just remember:

1. Log into the homestead box: "mysql -u homestead -p "   (enter "secret" when prompted for the password on the next line- it's masked)

2. Create your own database:  "create database your_database_name;"

and set this as the database name on your .env file, for example:





Oh. And when you create the articles migration, make a few changes as follows:

$table->timestamp("publishedat")->nullable();

//Notice I've added nullable to the defined timestamp, this will make the migration work otherwise you'll get the following error on running php artisan migrate





//Notice I've removed the underscore for published_at to read simply publishedat; this will save you a ton of grief when you get to the Eloquent stage, your Article object simply won't save(); and thus won't be committed to the database.


And if you're using Git Bash you can head over here "https://gist.github.com/hofmannsven/9164408" for some useful commands such as viewing your database tables and such.
 
permaculture is largely about replacing oil with people. And one tiny ad:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic