Why alpha installs need this
Lunar v2 ships a flat baseline: one migration per table, dated2026_01_01_*. While v2 was in alpha, schema changes were folded into those baseline migrations instead of being added as new migrations. An application that already ran a baseline migration does not run it again, so it never receives the columns that were added to that migration later.
Alpha releases were not intended for production use. If an application was built on one anyway, it needs a migration of its own to add the missing columns. From 2.0.0-beta.1 onward, the baseline migrations no longer change: every schema change ships as a new migration that php artisan migrate runs, so this page no longer grows.
New migration files are not a problem.
php artisan migrate runs any Lunar migration that is not yet recorded in the migrations table, such as create_refund_lines_table. Only changes made to a migration the application has already run need the steps on this page.Upgrading
- Find the alpha the application was installed on. Check
composer.lockfor thelunarphp/coreversion that was first installed, or look at the batch that recorded the2026_01_01_000000_create_assets_tablerow in themigrationstable and compare its date with the release dates below. - Create a migration in the application that adds every change listed under that release and each later one. Guard each change with
Schema::hasColumn()orSchema::hasTable(), so the migration is safe to run on any alpha and on a fresh install. - Give the migration a name that sorts before
2026_01_01_000071, for example2026_01_01_000070_catch_up_lunar_alpha_schema.php. Lunar’s2026_01_01_000071_add_product_types_default_tax_class_foreign_keymigration needsproduct_types.default_tax_class_idto exist, and Laravel runs migrations from every path in filename order. - Run
php artisan migrate.
lunarphp/upgrade package already adds most of these columns to v1 databases, with guards and backfills. Its data migrations in packages/upgrade/database/migrations are a useful reference, but do not run them against an alpha database: they are written for a v1 schema. The reference column in each table below names the relevant file.
Using an AI assistant
The tables on this page are written so an AI coding assistant can generate the catch-up migration. A prompt such as the following works well:Changes by release
Each section lists the changes that first appeared in that release. Apply the section for every release after the one the application was installed on. All table names below omit the configured table prefix (lunar_ by default).
2.0.0-alpha.1 to alpha.4
Released July 1 to July 8, 2026. These releases made no changes to existing migrations.2.0.0-alpha.5
Released August 29, 2026.brands.handle, collections.handle and product_types.handle are unique and not nullable. Add each as nullable, fill it with a unique value for every existing row (for example a slug of the name, with a numeric suffix for duplicates), then make it non-nullable and add the unique index.
New migrations in this release (run by php artisan migrate): 2026_01_01_000071_add_product_types_default_tax_class_foreign_key, 2026_01_01_000072_create_refund_lines_table, 2026_07_09_000000_create_staff_password_reset_tokens_table, the panel’s create_edit_drafts_table and create_staff_preferences_table, and PayPal’s create_paypal_orders_table.
staff.preferred_locale was originally added by a separate 2026_07_16_000000_add_preferred_locale_to_staff_table migration, which has since been folded into create_staff_table. An application installed on alpha.5 or later already has the column.2.0.0-alpha.6
Released September 1, 2026. This release made no changes to existing migrations.2.0.0-alpha.7
Released November 6, 2026.
New migrations in this release: the bundles package’s
create_bundles_table, create_bundle_groups_table and create_bundle_components_table.
2.0.0-alpha.8
Released November 10, 2026.
A
NULL totals column means the cart has not been calculated yet, so existing carts need no backfill.
2.0.0-alpha.9
Released November 11, 2026. This release made no changes to existing tables. It changed2026_01_03_000013_add_can_manage_shipping_permission to resolve the auth guard through core, which only matters for an application that has not run it yet.
2.0.0-beta.1
Released December 1, 2026. This is the last release that changed existing migrations.edit_drafts.version counts writes to a staff member’s draft, so the panel can refuse a save from a browser tab holding an older copy. Existing drafts need no backfill: each one starts at version 0, and the edit page passes the stored version to the panel.
product_option_values.colour holds the #RRGGBB colour of a value of a colour option, which alpha releases kept in meta['colour']. Lunar no longer reads the meta key, so copy it into the column, in upper case, for every value whose meta has one.
added_by_discount_id marks the cart lines a Buy X Get Y discount added automatically, which alpha releases recorded in meta['added_by_discount']. A line left unmarked behaves as a line the shopper added. To keep reward lines already in carts and orders marked, set added_by_discount_id to the discount ID used as the key in meta['added_by_discount'], then remove that key.
Lines with added_by_discount_id set now follow the reward their discount earns: each calculation lowers, raises or deletes them, and deleting the discount deletes them from carts without a completed order. They no longer count toward any discount’s conditions or minimum spend, and Cart::updateLine() refuses to change their quantity. No schema change is needed.
A null fulfilment_method or pickup_location_id means the choice is inferred as before, so carts, lines and variants need no backfill. Alpha releases recorded a pickup order with meta['pickup'] (meta['collect'] before alpha.8) on its shipping line, which Lunar no longer reads. Order::isPickup() now reads the order’s fulfilments, so orders that already have fulfilments keep their pickup status. For an order with no fulfilments yet, set orders.pickup_location_id to the default location’s ID where its shipping line’s meta->pickup or meta->collect is true, so its lines are still picked up when the fulfilments are created.
Pickup is only offered at a location with accepts_pickup set. Set it to true for the default location, and for any other location customers collect from, or pickup stops being offered. A custom Lunar\Core\Contracts\FulfilmentMethod adds isAvailable(): bool, returning true when it is always available.
continue_selling and sell_against_incoming replace product_variants.selling_policy and its backorder allowance. Map always to continue_selling = true, in_stock to continue_selling = false, and in_stock_or_on_backorder to continue_selling = false with sell_against_incoming = true. Selling beyond available stock now reads the tracked incoming bucket instead of the allowance, so for each in_stock_or_on_backorder variant with a positive backorder, add it to the incoming of the variant’s stock_levels row at the default location and to product_variants.stock_incoming, creating the row with zeroes elsewhere when there is none. The Lunar\Core\Enums\SellingPolicy enum is removed.
Folded migrations
These migrations shipped in an alpha and were later folded into the baseline. Their files no longer exist, but an application that ran them still has their rows in themigrations table.
The schema these migrations produced is unchanged, so an application that ran them needs no schema change. The leftover rows are harmless, but
php artisan migrate:rollback reports them as not found. Delete them once the catch-up migration has run: