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

Migration file conflicts #490

Closed
celaraze opened this issue Jan 2, 2024 · 1 comment
Closed

Migration file conflicts #490

celaraze opened this issue Jan 2, 2024 · 1 comment

Comments

@celaraze
Copy link

celaraze commented Jan 2, 2024

Sanctum Version

3.3.3

Laravel Version

10.39.0

PHP Version

8.3.1

Database Driver & Version

SQLite3 for macOS

Description

I'm not sure why Santum doesn't let users publish migration files to database/migrations like other composer packages. The migration should be done by the Artisan Migrate command instead of pre-built in runsMigrations = true.

I'd recommend removing the default migration file named create_personal_access_tokens_table.php from Laravel and publishing it via Sanctum.

Or set the runsMigrations = false by default. Leaving the migration command to Laravel.

Actually, I'd like to submit a PR to fix this, but I'm not sure if it's the right thing to do, so I submit an issue to discuss it first.

Steps To Reproduce

1, php artisan make:migration version_1_0_0.
2, Moving all migration commands from pre-defined migration files to verison_1_0_0.
3, Deleted all pre-defined migration files in Laravel.
4, php artisan migrate then throwing exception like:

 SQLSTATE[HY000]: General error: 1 table "personal_access_tokens" already exists (Connection: sqlite, SQL: create table "personal_access_tokens" ("id" integer primary key autoincrement not null, "tokenable_type" varchar not null, "tokenable_id" integer not null, "name" varchar not null, "token" varchar not null, "abilities" text, "last_used_at" datetime, "expires_at" datetime, "created_at" datetime, "updated_at" datetime))
@crynobone
Copy link
Member

This will be changed in the next major version. #480

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

2 participants