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

Adapt database schema with the demo #58

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/demo/db-seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function main() {
});
const { data: persistedContacts, error: errorContacts } = await supabase
.from('contacts')
.insert(contacts)
.insert(contacts.map(({ id, ...contact }) => contact))
.select();

if (errorContacts) {
Expand Down
15 changes: 12 additions & 3 deletions packages/demo/src/contacts/ContactInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,31 @@ import {
ReferenceInput,
AutocompleteInput,
BooleanInput,
required,
} from 'react-admin';
import { Divider, Box } from '@mui/material';

export const ContactInputs = () => {
return (
<Box flex="1" mt={-1}>
<Box display="flex" width={430}>
<TextInput source="first_name" fullWidth />
<TextInput
source="first_name"
validate={required()}
fullWidth
/>
<Spacer />
<TextInput source="last_name" fullWidth />
<TextInput source="last_name" validate={required()} fullWidth />
</Box>
<Box display="flex" width={430}>
<TextInput source="title" fullWidth />
<Spacer />
<ReferenceInput source="company_id" reference="companies">
<AutocompleteInput optionText="name" fullWidth />
<AutocompleteInput
optionText="name"
fullWidth
validate={required()}
/>
</ReferenceInput>
</Box>
<Divider />
Expand Down
31 changes: 31 additions & 0 deletions supabase/migrations/20240606161030_allow_nullable.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
alter table "public"."companies" alter column "address" drop not null;
alter table "public"."companies" alter column "city" drop not null;
alter table "public"."companies" alter column "created_at" drop not null;
alter table "public"."companies" alter column "linkedIn" drop not null;
alter table "public"."companies" alter column "logo" drop not null;
alter table "public"."companies" alter column "phone_number" drop not null;
alter table "public"."companies" alter column "sales_id" drop not null;
alter table "public"."companies" alter column "sector" drop not null;
alter table "public"."companies" alter column "size" drop not null;
alter table "public"."companies" alter column "stateAbbr" drop not null;
alter table "public"."companies" alter column "website" drop not null;
alter table "public"."companies" alter column "zipcode" drop not null;
alter table "public"."contacts" alter column "acquisition" drop not null;
alter table "public"."contacts" alter column "background" drop not null;
alter table "public"."contacts" alter column "email" drop not null;
alter table "public"."contacts" alter column "first_seen" drop not null;
alter table "public"."contacts" alter column "gender" drop not null;
alter table "public"."contacts" alter column "last_seen" drop not null;
alter table "public"."contacts" alter column "phone_number1" drop not null;
alter table "public"."contacts" alter column "phone_number2" drop not null;
alter table "public"."contacts" alter column "sales_id" drop not null;
alter table "public"."contacts" alter column "status" drop not null;
alter table "public"."contacts" alter column "title" drop not null;
alter table "public"."deals" alter column "amount" drop not null;
alter table "public"."deals" alter column "contact_ids" drop not null;
alter table "public"."deals" alter column "created_at" drop not null;
alter table "public"."deals" alter column "description" drop not null;
alter table "public"."deals" alter column "sales_id" drop not null;
alter table "public"."deals" alter column "start_at" drop not null;
alter table "public"."deals" alter column "type" drop not null;
alter table "public"."deals" alter column "updated_at" drop not null;
Loading