Skip to content

Commit 0596cea

Browse files
authored
feat: [CU-86b6nxuqb] migrate from mysql to postgres (#397)
1 parent 0cca402 commit 0596cea

File tree

6 files changed

+136
-108
lines changed

6 files changed

+136
-108
lines changed

.env.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ LOG_CHANNEL=stack
1212
LOG_STACK=single,nightwatch
1313
LOG_LEVEL=debug
1414

15-
DB_CONNECTION=mysql
16-
DB_HOST=127.0.0.1
17-
DB_PORT=3306
15+
DB_CONNECTION=pgsql
16+
DB_HOST=pgsql
17+
DB_PORT=5432
1818
DB_DATABASE=laravelcm
19-
DB_USERNAME=root
20-
DB_PASSWORD=
19+
DB_USERNAME=sail
20+
DB_PASSWORD=password
2121

2222
BROADCAST_DRIVER=log
2323
CACHE_DRIVER=file

app/Models/Plan.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,22 @@
99
use Illuminate\Database\Eloquent\Builder;
1010
use Laravelcm\Subscriptions\Models\Plan as Model;
1111

12+
/**
13+
* @mixin Model
14+
*
15+
* @property-read PlanType $type
16+
*/
1217
final class Plan extends Model
1318
{
19+
protected $guarded = [];
20+
21+
protected function casts(): array
22+
{
23+
return [
24+
'type' => PlanType::class,
25+
];
26+
}
27+
1428
/**
1529
* @param Builder<Plan> $query
1630
*/

database/seeders/ChannelSeeder.php

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ final class ChannelSeeder extends Seeder
1111
{
1212
public function run(): void
1313
{
14-
$authentification = Channel::create(['name' => 'Authentification', 'slug' => 'authentification', 'color' => '#31c48d']);
14+
$authentification = Channel::query()->create([
15+
'name' => 'Authentification',
16+
'slug' => 'authentification',
17+
'color' => '#31c48d',
18+
]);
1519
$authentification->items()->createMany([
1620
['name' => 'Breeze', 'slug' => 'breeze'],
1721
['name' => 'Fortify', 'slug' => 'fortify'],
@@ -21,14 +25,22 @@ public function run(): void
2125
['name' => 'UI', 'slug' => 'ui'],
2226
]);
2327

24-
$javascript = Channel::create(['name' => 'JavaScript', 'slug' => 'javascript', 'color' => '#fdae3f']);
28+
$javascript = Channel::query()->create([
29+
'name' => 'JavaScript',
30+
'slug' => 'javascript',
31+
'color' => '#fdae3f',
32+
]);
2533
$javascript->items()->createMany([
2634
['name' => 'React', 'slug' => 'react'],
2735
['name' => 'Vue.js', 'slug' => 'vue-js'],
2836
['name' => 'Alpine.js', 'slug' => 'alpine-js'],
2937
]);
3038

31-
$laravel = Channel::create(['name' => 'Laravel', 'slug' => 'laravel', 'color' => '#ff2d20']);
39+
$laravel = Channel::query()->create([
40+
'name' => 'Laravel',
41+
'slug' => 'laravel',
42+
'color' => '#ff2d20',
43+
]);
3244
$laravel->items()->createMany([
3345
['name' => 'Blade', 'slug' => 'blade'],
3446
['name' => 'Eloquent', 'slug' => 'eloquent'],
@@ -42,14 +54,22 @@ public function run(): void
4254
['name' => 'Laragon', 'slug' => 'laragon'],
4355
]);
4456

45-
$framework = Channel::create(['name' => 'Framework', 'slug' => 'framework', 'color' => '#fb70a9']);
57+
$framework = Channel::query()->create([
58+
'name' => 'Framework',
59+
'slug' => 'framework',
60+
'color' => '#fb70a9',
61+
]);
4662
$framework->items()->createMany([
4763
['name' => 'Inertia', 'slug' => 'inertia'],
4864
['name' => 'Livewire', 'slug' => 'livewire'],
4965
['name' => 'TailwindCSS', 'slug' => 'tailwindcss'],
5066
]);
5167

52-
$hosting = Channel::create(['name' => 'Hosting', 'slug' => 'hosting', 'color' => '#0080ff']);
68+
$hosting = Channel::query()->create([
69+
'name' => 'Hosting',
70+
'slug' => 'hosting',
71+
'color' => '#0080ff',
72+
]);
5373
$hosting->items()->createMany([
5474
['name' => 'Digital Ocean', 'slug' => 'digital-ocean'],
5575
['name' => 'Forge', 'slug' => 'forge'],
@@ -59,18 +79,30 @@ public function run(): void
5979
['name' => 'AWS', 'slug' => 'aws'],
6080
]);
6181

62-
$outils = Channel::create(['name' => 'Outils', 'slug' => 'outils', 'color' => '#333333']);
63-
$outils->items()->createMany([
82+
$tools = Channel::query()->create([
83+
'name' => 'Outils',
84+
'slug' => 'outils',
85+
'color' => '#333333',
86+
]);
87+
$tools->items()->createMany([
6488
['name' => 'Github Actions', 'slug' => 'github-actions'],
65-
['name' => 'Gitlab', 'slug' => 'gitlab'],
89+
['name' => 'Gitlab CI', 'slug' => 'gitlab-ci'],
6690
]);
6791

68-
$design = Channel::create(['name' => 'Design', 'slug' => 'design', 'color' => '#6D28D9']);
92+
$design = Channel::query()->create([
93+
'name' => 'Design',
94+
'slug' => 'design',
95+
'color' => '#6D28D9',
96+
]);
6997
$design->items()->createMany([
7098
['name' => 'UI/UX', 'slug' => 'ui-ux'],
7199
]);
72100

73-
$divers = Channel::create(['name' => 'Divers', 'slug' => 'divers', 'color' => '#DB2777']);
101+
$divers = Channel::query()->create([
102+
'name' => 'Divers',
103+
'slug' => 'divers',
104+
'color' => '#DB2777',
105+
]);
74106
$divers->items()->createMany([
75107
['name' => 'Laravel.cm', 'slug' => 'laravelcm'],
76108
['name' => 'Gaming', 'slug' => 'gaming'],

database/seeders/DeveloperPremiumPlanSeeder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ final class DeveloperPremiumPlanSeeder extends Seeder
1414
{
1515
public function run(): void
1616
{
17-
$rookiePlan = Plan::create([
18-
'name' => 'Le Rookie',
17+
$rookiePlan = Plan::query()->create([
18+
'name' => 'Builder',
1919
'description' => 'Pour tous ceux qui veulent apprendre et avoir le contenu minimal',
20-
'type' => PlanType::DEVELOPER->value,
20+
'type' => PlanType::DEVELOPER,
2121
'price' => 2000,
2222
'signup_fee' => 0,
2323
'invoice_period' => 1,
@@ -34,10 +34,10 @@ public function run(): void
3434
new Feature(['name' => 'Accès au code source des tutoriels', 'value' => 1, 'sort_order' => 5]),
3535
]);
3636

37-
$proPlan = Plan::create([
38-
'name' => 'Le Pro',
37+
$proPlan = Plan::query()->create([
38+
'name' => 'Artisan',
3939
'description' => 'Pour les professionnels du métier',
40-
'type' => PlanType::DEVELOPER->value,
40+
'type' => PlanType::DEVELOPER,
4141
'price' => 5000,
4242
'signup_fee' => 0,
4343
'invoice_period' => 1,

docker-compose.prod.yml

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
services:
22
laravelcm:
33
build:
4-
context: '.'
4+
context: .
55
dockerfile: Dockerfile
66
args:
77
NODE_VERSION: '22'
88
PHP_VERSION: 8.4
9-
image: 'laravelcm/php'
9+
image: laravelcm/php
1010
extra_hosts:
1111
- 'host.docker.internal:host-gateway'
1212
healthcheck:
13-
test: ["CMD", "curl", "-f", "http://localhost:${APP_PORT:-8080}/up"]
13+
test: ['CMD', 'curl', '-f', 'http://localhost:${APP_PORT:-8080}/up']
1414
timeout: 30s
1515
environment:
1616
APP_NAME: ${APP_NAME}
@@ -21,10 +21,6 @@ services:
2121
APP_DOMAIN: ${APP_DOMAIN}
2222
APP_URL: ${APP_URL}
2323
ASSET_URL: ${ASSET_URL}
24-
APP_LICENCE_DOMAIN: ${APP_LICENCE_DOMAIN}
25-
APP_LICENCE_API: ${APP_LICENCE_API}
26-
ANALYTICS_PROPERTY_ID: ${ANALYTICS_PROPERTY_ID}
27-
APP_DEMO: ${APP_DEMO}
2824
APP_LOCALE: ${APP_LOCALE}
2925
APP_FALLBACK_LOCALE: ${APP_FALLBACK_LOCALE}
3026
APP_FAKER_LOCALE: ${APP_FAKER_LOCALE}
@@ -75,9 +71,6 @@ services:
7571
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
7672
ANTHROPIC_API_VERSION: ${ANTHROPIC_API_VERSION}
7773
OLLAMA_URL: ${OLLAMA_URL}
78-
GROQ_API_KEY: ${GROQ_API_KEY}
79-
XAI_API_KEY: ${XAI_API_KEY}
80-
GEMINI_API_KEY: ${GEMINI_API_KEY}
8174
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
8275
SCOUT_DRIVER: ${SCOUT_DRIVER}
8376
TYPESENSE_HOST: ${TYPESENSE_HOST}
@@ -88,7 +81,7 @@ services:
8881
STRIPE_VERSION: ${STRIPE_VERSION}
8982
NOTCHPAY_PUBLIC_KEY: ${NOTCHPAY_PUBLIC_KEY}
9083
NOTCHPAY_SECRET_KEY: ${NOTCHPAY_SECRET_KEY}
91-
OCTANE_SERVER: frankenphp
84+
OCTANE_SERVER: 'frankenphp'
9285
CADDY_GLOBAL_OPTIONS: |
9386
servers {
9487
trusted_proxies static private_ranges
@@ -108,11 +101,11 @@ services:
108101
networks:
109102
- dokploy-network
110103
schedule:
111-
image: 'laravelcm/php'
112-
command: ["artisan", "schedule:work"]
104+
image: laravelcm/php
105+
command: ['artisan', 'schedule:work']
113106
stop_signal: SIGTERM
114107
healthcheck:
115-
test: ["CMD", "healthcheck-schedule"]
108+
test: ['CMD', 'healthcheck-schedule']
116109
start_period: 10s
117110
environment:
118111
APP_NAME: ${APP_NAME}
@@ -123,10 +116,6 @@ services:
123116
APP_DOMAIN: ${APP_DOMAIN}
124117
APP_URL: ${APP_URL}
125118
ASSET_URL: ${ASSET_URL}
126-
APP_LICENCE_DOMAIN: ${APP_LICENCE_DOMAIN}
127-
APP_LICENCE_API: ${APP_LICENCE_API}
128-
ANALYTICS_PROPERTY_ID: ${ANALYTICS_PROPERTY_ID}
129-
APP_DEMO: ${APP_DEMO}
130119
APP_LOCALE: ${APP_LOCALE}
131120
APP_FALLBACK_LOCALE: ${APP_FALLBACK_LOCALE}
132121
APP_FAKER_LOCALE: ${APP_FAKER_LOCALE}
@@ -177,9 +166,6 @@ services:
177166
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
178167
ANTHROPIC_API_VERSION: ${ANTHROPIC_API_VERSION}
179168
OLLAMA_URL: ${OLLAMA_URL}
180-
GROQ_API_KEY: ${GROQ_API_KEY}
181-
XAI_API_KEY: ${XAI_API_KEY}
182-
GEMINI_API_KEY: ${GEMINI_API_KEY}
183169
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
184170
SCOUT_DRIVER: ${SCOUT_DRIVER}
185171
TYPESENSE_HOST: ${TYPESENSE_HOST}
@@ -197,11 +183,11 @@ services:
197183
depends_on:
198184
- laravelcm
199185
queue:
200-
image: 'laravelcm/php'
201-
command: ["artisan", "queue:work", "--tries=3", "--queue=default,media"]
186+
image: laravelcm/php
187+
command: ['artisan', 'queue:work', '--tries=3', '--queue=default,media']
202188
stop_signal: SIGTERM
203189
healthcheck:
204-
test: ["CMD", "healthcheck-queue"]
190+
test: ['CMD', 'healthcheck-queue']
205191
start_period: 10s
206192
environment:
207193
APP_NAME: ${APP_NAME}
@@ -212,10 +198,6 @@ services:
212198
APP_DOMAIN: ${APP_DOMAIN}
213199
APP_URL: ${APP_URL}
214200
ASSET_URL: ${ASSET_URL}
215-
APP_LICENCE_DOMAIN: ${APP_LICENCE_DOMAIN}
216-
APP_LICENCE_API: ${APP_LICENCE_API}
217-
ANALYTICS_PROPERTY_ID: ${ANALYTICS_PROPERTY_ID}
218-
APP_DEMO: ${APP_DEMO}
219201
APP_LOCALE: ${APP_LOCALE}
220202
APP_FALLBACK_LOCALE: ${APP_FALLBACK_LOCALE}
221203
APP_FAKER_LOCALE: ${APP_FAKER_LOCALE}
@@ -266,9 +248,6 @@ services:
266248
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
267249
ANTHROPIC_API_VERSION: ${ANTHROPIC_API_VERSION}
268250
OLLAMA_URL: ${OLLAMA_URL}
269-
GROQ_API_KEY: ${GROQ_API_KEY}
270-
XAI_API_KEY: ${XAI_API_KEY}
271-
GEMINI_API_KEY: ${GEMINI_API_KEY}
272251
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
273252
SCOUT_DRIVER: ${SCOUT_DRIVER}
274253
TYPESENSE_HOST: ${TYPESENSE_HOST}

0 commit comments

Comments
 (0)