@@ -107,6 +107,31 @@ model Tag {
107107 expect ( restoredSchema ) . toEqual ( schema ) ;
108108 } ) ;
109109
110+ it ( 'should restore one-to-one relation when FK is the single-column primary key' , async ( ) => {
111+ const { workDir, schema } = await createFormattedProject (
112+ `model Profile {
113+ user User @relation(fields: [id], references: [id], onDelete: Cascade)
114+ id Int @id @default(autoincrement())
115+ bio String?
116+ }
117+
118+ model User {
119+ id Int @id @default(autoincrement())
120+ email String @unique
121+ profile Profile?
122+ }` ,
123+ ) ;
124+ runCli ( 'db push' , workDir ) ;
125+
126+ const schemaFile = path . join ( workDir , 'zenstack/schema.zmodel' ) ;
127+
128+ fs . writeFileSync ( schemaFile , getDefaultPrelude ( ) ) ;
129+ runCli ( 'db pull --indent 4' , workDir ) ;
130+
131+ const restoredSchema = getSchema ( workDir ) ;
132+ expect ( restoredSchema ) . toEqual ( schema ) ;
133+ } ) ;
134+
110135 it ( 'should restore schema with indexes and unique constraints' , async ( ) => {
111136 const { workDir, schema } = await createFormattedProject (
112137 `model User {
@@ -155,6 +180,29 @@ model Tag {
155180 expect ( restoredSchema ) . toEqual ( schema ) ;
156181 } ) ;
157182
183+ it ( 'should preserve Decimal and Float default value precision' , async ( ) => {
184+ const { workDir, schema } = await createFormattedProject (
185+ `model Product {
186+ id Int @id @default(autoincrement())
187+ price Decimal @default(99.99)
188+ discount Decimal @default(0.50)
189+ taxRate Decimal @default(7.00)
190+ weight Float @default(1.5)
191+ rating Float @default(4.0)
192+ temperature Float @default(98.6)
193+ }` ,
194+ ) ;
195+ runCli ( 'db push' , workDir ) ;
196+
197+ const schemaFile = path . join ( workDir , 'zenstack/schema.zmodel' ) ;
198+
199+ fs . writeFileSync ( schemaFile , getDefaultPrelude ( ) ) ;
200+ runCli ( 'db pull --indent 4' , workDir ) ;
201+
202+ const restoredSchema = getSchema ( workDir ) ;
203+ expect ( restoredSchema ) . toEqual ( schema ) ;
204+ } ) ;
205+
158206 } ) ;
159207
160208 describe ( 'Pull with existing schema - preserve schema features' , ( ) => {
0 commit comments