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

hotfix: flyway ddl 수정 #522

Merged
merged 2 commits into from
Sep 25, 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 backend/secrets
35 changes: 20 additions & 15 deletions backend/src/main/resources/db/migration/V1__init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE member (
CREATE TABLE IF NOT EXISTS member (
id BIGINT AUTO_INCREMENT,
email VARCHAR(255),
provider VARCHAR(255) NOT NULL CHECK (provider IN ('GITHUB')),
Expand All @@ -9,7 +9,7 @@ CREATE TABLE member (
CONSTRAINT pk_member PRIMARY KEY (id)
);

CREATE TABLE mission (
CREATE TABLE IF NOT EXISTS mission (
id BIGINT AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
thumbnail VARCHAR(255) NOT NULL,
Expand All @@ -18,7 +18,7 @@ CREATE TABLE mission (
CONSTRAINT pk_mission PRIMARY KEY (id)
);

CREATE TABLE discussion (
CREATE TABLE IF NOT EXISTS discussion (
id BIGINT AUTO_INCREMENT,
title VARCHAR(255),
content TEXT NOT NULL,
Expand All @@ -30,6 +30,11 @@ CREATE TABLE discussion (
CONSTRAINT fk_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
);

ALTER TABLE discussion DROP FOREIGN KEY fk_member;
ALTER TABLE discussion DROP FOREIGN KEY fk_mission;
ALTER TABLE discussion ADD CONSTRAINT fk_discussion_member FOREIGN KEY (member_id) REFERENCES member(id);
ALTER TABLE discussion ADD CONSTRAINT fk_discussion_mission FOREIGN KEY (mission_id) REFERENCES mission(id);

CREATE TABLE discussion_comment (
id BIGINT AUTO_INCREMENT,
content TEXT NOT NULL,
Expand All @@ -39,9 +44,9 @@ CREATE TABLE discussion_comment (
deleted_at TIMESTAMP(6),
created_at TIMESTAMP(6) NOT NULL,
CONSTRAINT pk_discussion_comment PRIMARY KEY (id),
CONSTRAINT fk_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_discussion_comment FOREIGN KEY (parent_comment_id) REFERENCES discussion_comment(id)
CONSTRAINT fk_discussion_comment_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_discussion_comment_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_discussion_comment_discussion_comment FOREIGN KEY (parent_comment_id) REFERENCES discussion_comment(id)
);

CREATE TABLE hash_tag (
Expand All @@ -54,17 +59,17 @@ CREATE TABLE discussion_hash_tag (
discussion_id BIGINT NOT NULL,
hash_tag_id BIGINT NOT NULL,
CONSTRAINT pk_discussion_hash_tag PRIMARY KEY (discussion_id, hash_tag_id),
CONSTRAINT fk_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id)
CONSTRAINT fk_discussion_hash_tag_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_discussion_hash_tag_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id)
);

CREATE TABLE mission_hash_tag (
id BIGINT AUTO_INCREMENT,
mission_id BIGINT NOT NULL,
hash_tag_id BIGINT NOT NULL,
CONSTRAINT pk_mission_hash_tag PRIMARY KEY (id),
CONSTRAINT fk_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id),
CONSTRAINT fk_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
CONSTRAINT fk_mission_hash_tag_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id),
CONSTRAINT fk_mission_hash_tag_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
);

CREATE TABLE solution (
Expand All @@ -77,8 +82,8 @@ CREATE TABLE solution (
status VARCHAR(255) NOT NULL CHECK (status IN ('IN_PROGRESS','COMPLETED')),
created_at TIMESTAMP(6) NOT NULL,
CONSTRAINT pk_solution PRIMARY KEY (id),
CONSTRAINT fk_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
CONSTRAINT fk_solution_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_solution_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
);

CREATE TABLE solution_comment (
Expand All @@ -90,7 +95,7 @@ CREATE TABLE solution_comment (
deleted_at TIMESTAMP(6),
created_at TIMESTAMP(6) NOT NULL,
CONSTRAINT pk_solution_comment PRIMARY KEY (id),
CONSTRAINT fk_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_solution_comment FOREIGN KEY (parent_comment_id) REFERENCES solution_comment(id),
CONSTRAINT fk_solution FOREIGN KEY (solution_id) REFERENCES solution(id)
CONSTRAINT fk_solution_comment_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_solution_comment_solution_comment FOREIGN KEY (parent_comment_id) REFERENCES solution_comment(id),
CONSTRAINT fk_solution_comment_solution FOREIGN KEY (solution_id) REFERENCES solution(id)
);
50 changes: 25 additions & 25 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,34 +256,34 @@ export const router = createBrowserRouter(routes, {
basename: ROUTES.main,
});

async function enableMocking() {
if (process.env.NODE_ENV !== 'development') {
return;
}
// async function enableMocking() {
// if (process.env.NODE_ENV !== 'development') {
// return;
// }

const { worker } = await import('./mocks/browser');
// const { worker } = await import('./mocks/browser');

// `worker.start()` returns a Promise that resolves
// once the Service Worker is up and ready to intercept requests.
return worker.start();
}
// // `worker.start()` returns a Promise that resolves
// // once the Service Worker is up and ready to intercept requests.
// return worker.start();
// }

enableMocking().then(() => {
root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<QueryErrorBoundary>
<ErrorBoundary fallback={<div>에러에요!</div>}>
<ThemeProvider theme={theme}>
<GlobalStyle />
<RouterProvider router={router} />
</ThemeProvider>
</ErrorBoundary>
</QueryErrorBoundary>
</QueryClientProvider>
</React.StrictMode>,
);
});
// enableMocking().then(() => {
// root.render(
// <React.StrictMode>
// <QueryClientProvider client={queryClient}>
// <QueryErrorBoundary>
// <ErrorBoundary fallback={<div>에러에요!</div>}>
// <ThemeProvider theme={theme}>
// <GlobalStyle />
// <RouterProvider router={router} />
// </ThemeProvider>
// </ErrorBoundary>
// </QueryErrorBoundary>
// </QueryClientProvider>
// </React.StrictMode>,
// );
// });

root.render(
<React.StrictMode>
Expand Down
Loading