When trying to push:mysql its warning that schema has changed and data will be lost when it hasnt.

· You're about to change projected_points column type from alter_table_alter_column_set_type to decimal with 689 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
· You're about to change projected_points column type from alter_table_alter_column_set_type to decimal with 689 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
No changes have been made ...
6 Replies
Andrii Sherman
could you please send a schema table for this case? also did you change a schema or database? or nothing was changed both in schema and databse?
Jokerz
JokerzOP2y ago
import { sql } from "drizzle-orm";
import {
serial,
int,
text,
timestamp,
mysqlTable,
boolean,
mysqlEnum,
decimal,
} from "drizzle-orm/mysql-core";

export const players = mysqlTable("players", {
id: serial("id").primaryKey(),
rapidApi: int("rapid_api").notNull(),
proTeamId: int("pro_team_id").notNull(),
proLeagueId: int("pro_league_id").notNull(),
name: text("name").notNull(),
age: int("age"),
number: int("number"),
photo: text("photo").notNull(),
position: mysqlEnum("position", [
"Goalkeeper",
"Defender",
"Midfielder",
"Attacker",
]).notNull(),
ranking: int("ranking"),
projectedPoints: decimal("projected_points"),
createdAt: timestamp("created_at")
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
import { sql } from "drizzle-orm";
import {
serial,
int,
text,
timestamp,
mysqlTable,
boolean,
mysqlEnum,
decimal,
} from "drizzle-orm/mysql-core";

export const players = mysqlTable("players", {
id: serial("id").primaryKey(),
rapidApi: int("rapid_api").notNull(),
proTeamId: int("pro_team_id").notNull(),
proLeagueId: int("pro_league_id").notNull(),
name: text("name").notNull(),
age: int("age"),
number: int("number"),
photo: text("photo").notNull(),
position: mysqlEnum("position", [
"Goalkeeper",
"Defender",
"Midfielder",
"Attacker",
]).notNull(),
ranking: int("ranking"),
projectedPoints: decimal("projected_points"),
createdAt: timestamp("created_at")
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
i imported and set data, 689 players and when i was building on another table, and trying to push that to the database i got this
Andrii Sherman
Got it, thanks Looking into it
Jokerz
JokerzOP2y ago
import { sql } from "drizzle-orm";
import {
serial,
int,
text,
timestamp,
mysqlTable,
} from "drizzle-orm/mysql-core";

export const userTeams = mysqlTable("user_leagues", {
id: serial("id").primaryKey(),
userId: int("user_id").notNull(),
name: text("name").notNull(),
leagueId: int("league_id").notNull(),
abbreviation: text("abbreviation").notNull(),
teamLogo: text("team_logo").notNull(),
createdAt: timestamp("created_at")
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
import { sql } from "drizzle-orm";
import {
serial,
int,
text,
timestamp,
mysqlTable,
} from "drizzle-orm/mysql-core";

export const userTeams = mysqlTable("user_leagues", {
id: serial("id").primaryKey(),
userId: int("user_id").notNull(),
name: text("name").notNull(),
leagueId: int("league_id").notNull(),
abbreviation: text("abbreviation").notNull(),
teamLogo: text("team_logo").notNull(),
createdAt: timestamp("created_at")
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
this was the seperate table i was working on thanks man ❤️
Jokerz
JokerzOP2y ago
dont know if this helps, this is the database table on planetscale
Jokerz
JokerzOP2y ago
Any thoughts on this?
Want results from more Discord servers?
Add your server