Comments (4)
@antonlyap can you please share your database schema in .sql format? you can use pg_dump --schema-only databasename
if that's a PG database.
from motor-admin.
Here's the complete dump. Sorry if it's too long, didn't want to leave out anything important.
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.3
-- Dumped by pg_dump version 15.3
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: accounts; Type: TABLE; Schema: public; Owner: root
--
CREATE TABLE public.accounts (
id integer NOT NULL,
name character varying(30) NOT NULL,
currency character(3) NOT NULL,
bank text NOT NULL,
opening_balance money NOT NULL
);
ALTER TABLE public.accounts OWNER TO root;
--
-- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--
CREATE SEQUENCE public.accounts_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.accounts_id_seq OWNER TO root;
--
-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--
ALTER SEQUENCE public.accounts_id_seq OWNED BY public.accounts.id;
--
-- Name: transactions; Type: TABLE; Schema: public; Owner: root
--
CREATE TABLE public.transactions (
id integer NOT NULL,
date timestamp with time zone NOT NULL,
amount_account money NOT NULL,
amount_original money NOT NULL,
currency character(3) NOT NULL,
description text,
category text DEFAULT 'Uncategorized'::text NOT NULL,
account integer NOT NULL
);
ALTER TABLE public.transactions OWNER TO root;
--
-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--
CREATE SEQUENCE public.transactions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.transactions_id_seq OWNER TO root;
--
-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--
ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
--
-- Name: accounts id; Type: DEFAULT; Schema: public; Owner: root
--
ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.accounts_id_seq'::regclass);
--
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: root
--
ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);
--
-- Name: accounts accounts_pk; Type: CONSTRAINT; Schema: public; Owner: root
--
ALTER TABLE ONLY public.accounts
ADD CONSTRAINT accounts_pk PRIMARY KEY (id);
--
-- Name: transactions transactions_pk; Type: CONSTRAINT; Schema: public; Owner: root
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT transactions_pk PRIMARY KEY (id);
--
-- Name: transactions transactions_fk; Type: FK CONSTRAINT; Schema: public; Owner: root
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT transactions_fk FOREIGN KEY (account) REFERENCES public.accounts(id);
--
-- PostgreSQL database dump complete
--
from motor-admin.
@antonlyap the issue is caused by your account foreign key name "account" in the transaction table.
Motor Admin uses widely adopted DB table/columns naming conventions to build the CRUD UI on top if the DB schema.
https://github.com/RootSoft/Database-Naming-Convention#foreign-keys
So to make everything work you need to use account_id, transaction_id column name for foreign keys.
from motor-admin.
Renaming account
to account_id
fixed it. Transaction ID is only used as a primary key, so its name stays as id
according to the convention. Thank you.
from motor-admin.
Related Issues (20)
- Is possible customize locale in motor admin docker? HOT 1
- Defining postgres schemas not working HOT 1
- Motor Admin hides the resource for unknown reason, based on name maybe? HOT 1
- Duplicate Key Name Error 'motor_auditable_index' on Starting Docker Container HOT 1
- Permit cross-domain framing HOT 2
- heic image not showing HOT 1
- Does the database connection support over SSL or over SSH? HOT 1
- Variable Support in Queries HOT 2
- Custom filters on queries HOT 1
- self hosted supabase/postgres connection timeout HOT 1
- Customise Data Display HOT 1
- Removing Motor Admin HOT 1
- duplicate key value violates unique constraint "motor_audits_pkey" HOT 1
- Unable to send email alerts HOT 1
- Allow setting a max age for the login cookie to limit session length HOT 1
- how to change date field format HOT 1
- how to disable user to edit setting HOT 1
- Link to child resource in single table inheritance HOT 1
- Is possiable add action form to query table? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from motor-admin.