Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update

spring.jpa.hibernate.ddl-auto=none
spring.sql.init.mode=always
spring.sql.init.schema-locations=classpath:schema.sql
spring.sql.init.data-locations=classpath:data.sql
spring.jpa.show-sql=false

# Security
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
INSERT INTO post (title, content, slug, is_published, published_at, intro) VALUES
('The Impact of Climate Change on Wildlife',
'Climate change is profoundly affecting wildlife across the globe. Rising temperatures, shifting weather patterns, and altered habitats are forcing many species to adapt, migrate, or face the risk of extinction. Polar bears, coral reefs, and migratory birds are just a few examples of wildlife impacted by these environmental changes. Conservation efforts are increasingly focusing on mitigating these effects through habitat protection, climate action, and raising awareness about the interconnectedness of ecosystems. The survival of countless species depends on how effectively humanity addresses climate change in the coming decades.',
'impact-of-climate-change-on-wildlife', TRUE, CURRENT_TIMESTAMP,
'Examining how climate change is threatening wildlife and what can be done to protect vulnerable species.'),

('The Evolution of Digital Communication',
'Digital communication has transformed how people connect, share ideas, and conduct business worldwide. From the invention of email and instant messaging to the rise of social media platforms, the way we communicate has become faster, more accessible, and often more visual. This evolution has bridged distances, enabling global collaboration and real-time interaction. However, it also presents challenges such as information overload, privacy concerns, and the spread of misinformation. Understanding the history and impact of digital communication is essential as society continues to navigate its benefits and pitfalls.',
'the-evolution-of-digital-communication', TRUE, CURRENT_TIMESTAMP,
'A comprehensive look at how digital communication has changed our world and the challenges it presents.');
21 changes: 21 additions & 0 deletions src/main/resources/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS post (
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
title VARCHAR(255),
content CLOB,
slug VARCHAR(255) NOT NULL UNIQUE,
is_published BOOLEAN,
published_at TIMESTAMP,
intro VARCHAR(400)
);
CREATE TABLE IF NOT EXISTS project (
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(255),
description VARCHAR(255)
);
CREATE TABLE IF NOT EXISTS users (
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
username VARCHAR(255),
password VARCHAR(255),
firstName VARCHAR(255),
lastName VARCHAR(255)
);